您好,我对 GregorianCalendar 有疑问。
里面有什么问题?
2010/6/1 而不是 2010/05/31 的结果如何?
package test;
import java.util.Calendar;
import java.util.GregorianCalendar;
public class Main {
public static void main(String[] args) {
Calendar cal = new GregorianCalendar(2010, 5, 31);
System.out.println(cal.get(Calendar.YEAR) + "/" + cal.get(Calendar.MONTH) + "/" + cal.get(Calendar.DAY_OF_MONTH));
}
}