Just scanning through the code, I could spot one potential problem: In the getMonth() method, you are taking
String "
mon" as an argument, but then you are not using it anywhere in the method, instead you are comparing the class-level "
month" variable value with String month names. So, the value "newMonth" obtained in the main method is getting lost in the process, since the months you compare are always the same (i.e. both are values got from class level variable "month"). This is probably the reason why your code only finds difference in the years entered, and then multiplies it by 12 and gives the answer in number of months and you are getting answers like 12 months, 24 months, 48 months etc.
Other than this, in the monthsUtil method, I find the logic to calculate the "diff" a bit weird. For example, if you choose January 2000 and June 2001 as your two dates, then the expression
would give the answer as 7, which is incorrect. I guess you would need to work on this logic a bit.