Why does the GregorianCalendar class default to random values in Java?

I’m writing a new calendar program so that as I was debugging the program I noticed that the compiler offers assigned any value with 1, 3 and SOME to SEASON, MONTH, and also DAY respectively.Why is always that Shouldn’t those people default in order to today’s time frame (2011, 5 VARIOUS, and 10)

Work schedule cal = brand-new GregorianCalendar();
cal = brand-new GregorianCalendar(Calendar.YEAR, Calendar

Yahoo trunicated your snippet.If you wanted present day date…

Work schedule cal = brand-new GregorianCalendar( 2011, 5 VARIOUS, 11 );
and then to consider that Gregorian possesses 50+ static area variables.

cal.set( Work schedule.MONTH, 12 ); // is a 12th month, December
or
cal.set( Work schedule.MONTH, Work schedule.DECEMBER ); // the second field can be a number well worth 11

together with myCalendar.set( fieldToSet, Price );

in the beginning Calendar is definitely bewildering, but as soon as you get experienced with it, it is very nice.You are able to keep introducing days, hrs, minutes, whatever after which the many months and decades rollover.

The shortcut to an immediate ‘today’ is
Work schedule cal = Diary.getInstance(); // mainly because Calendar is definitely abstract, these have that just one convenience method().

Leave a Reply