下面的代码工作正常,除了什么时候calendar.MONTH set to 1 (Feb)
,我不知道为什么?谢谢。
Calendar calendar = Calendar.getInstance();
calendar.setLenient(false);
calendar.set(Calendar.YEAR, 2013);
calendar.set(Calendar.MONTH, 1); // Only when "Feb" failed with illegalArgumentException
int maxDays = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); <= If Calendar.MONTH set to 1, this line will "java.lang.IllegalArgumentException"