This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Hi Campbell is right. 0 represents Jan,so 4 will represent May. When you pass 2008,4,11 to teh constructor, it has taken it as May 11,2008, which happens to be a Sunday You have written your own method to get the Month and Day . So you output the Month as April, based on the case statement (case 1 is Jan to you). When you want to get the Day,in the case statement, you have written as CALENDAR.SUNDAY as Sunday and so on.
If I become filthy rich, I'll sponsor research for painless dental treatment at Harvard Medical School. Thats why,I'm learning Java.I have 32 teeth, 22 are man made.
Please note the inconsistency in the Calendar API: weekdays start at 1 (Calendar.SUNDAY) whereas months start at 0 (Calendar.JANUARY). That's why it is always a wise idea to use the constants instead of hard coded values like 4.
subject: Question about the day-of-week in GregorianCalendar