This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
If you look at the GregorianCalendar API, you'll see that this class inherits a get(int) method from its Calendar parent. The int variable is a Calendar field, declared in static variables in the Calendar class. For example, static int MONTH, static int YEAR. These are static variables, with a value assigned to it. YEAR happens to be 1, MONTH 2, DAY_OF_MONTH 5 (check them here). By retrieving the yar, month and day, you can make a new calendar, the way it's done above. BUT.... never do it like this. Use Calendar.YEAR, Calendar.MONTH and other declared variables, not their values.
First of all, it's not a good idea to use numbers directly when calling the get() method - it makes it impossible to understand immediately what happens by just looking at the source code. Instead of using numbers, use the constants defined in class Calendar, for example: