Java code doesn't produce output


2 Answer(s)


Hello Srinivasa:

If you hover over the "strikeouts" with the mouse, you will see that the "strikeout", in this case, is indicating a deprecated method, getYear().

The quick fix is to add the @SuppressWarnings("deprecation") on the line just prior to the deprecated method. The strikeout will still appear, however.

Or, if you want to experiment, you could modify the deprecated method with the new Calendar.get(Calendar.YEAR)-1900 method. This information will appear once you add the "@Supr.." on the prior line and hovering over the "strikeout" with your mouse.

However, the program should still work as written with the deprecated method.

hi Srinivasa,

Strike through is enabled in eclipse only if the method is deprecated and the program will work without issues.

in the below line Year and Month are concatenated and printed (
String monthYear=date.getYear() + "_" + date.getMonth();). Please check if there is any problem with the input data as the code looks fine.