Calendar myCal = Calendar.getInstance();
System.out.println(myCal.getActualMaximum(Calendar.DATE));
That works, I just tested it on my machine. And according to the Javadoc, DATE is a synonym for DAY_OF_MONTH so day of month should work as well. Although it won't mess anything up, you shouldn't use your instance variable (calendar) to refer to a static field (DAY_OF_MONTH). And of course, that method will return the maximum value for the current month (April) so if you are concerned with a different month you'll have to set the Calendar explicitly first.
BestJewSinceJC
Posting Maven
2,772 posts since Sep 2008
Reputation Points: 874
Solved Threads: 354
No problem - mark solved threads as solved
BestJewSinceJC
Posting Maven
2,772 posts since Sep 2008
Reputation Points: 874
Solved Threads: 354