java 的Calendar小问题(有代码)
importjava.util.Calendar;publicclassTestLenient{privatestaticfinalintMONTH=0;publicst...
import java.util.Calendar;
public class TestLenient {
private static final int MONTH = 0;
public static void main(String[] args) {
Calendar cal = Calendar.getInstance();
cal.set(MONTH, 3);
System.out.println(cal.getTime());
}
}
Exception in thread "main" java.lang.IllegalArgumentException: Invalid era
at java.util.GregorianCalendar.computeTime(Unknown Source)
at java.util.Calendar.updateTime(Unknown Source)
at java.util.Calendar.getTimeInMillis(Unknown Source)
at java.util.Calendar.getTime(Unknown Source)
at ch09.TestLenient.main(TestLenient.java:12)
怎么个意思,望高手解释下,谢啦 展开
public class TestLenient {
private static final int MONTH = 0;
public static void main(String[] args) {
Calendar cal = Calendar.getInstance();
cal.set(MONTH, 3);
System.out.println(cal.getTime());
}
}
Exception in thread "main" java.lang.IllegalArgumentException: Invalid era
at java.util.GregorianCalendar.computeTime(Unknown Source)
at java.util.Calendar.updateTime(Unknown Source)
at java.util.Calendar.getTimeInMillis(Unknown Source)
at java.util.Calendar.getTime(Unknown Source)
at ch09.TestLenient.main(TestLenient.java:12)
怎么个意思,望高手解释下,谢啦 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询