c1.get(c1.MONTH)+1,这里为什么要加1??
importjava.util.*;publicclassCalendarDemo{publicstaticvoidmain(String[]args){Calendar...
import java.util.*;
public class CalendarDemo
{
public static void main(String [] args)
{
Calendar c1=Calendar.getInstance();
System.out.println(c1.get(c1.YEAR)+"year"+(c1.get(c1.MONTH)+1)+"month"+c1.get(c1.DAY_OF_MONTH)+"day"+c1.get(c1.HOUR)+":"+c1.get(c1.MINUTE)+":"+c1.get(c1.SECOND));
c1.add(c1.DAY_OF_YEAR,230);
System.out.println(c1.get(c1.YEAR)+"year"+(c1.get(c1.MONTH)+1)+"month"+c1.get(c1.DAY_OF_MONTH)+"day"+c1.get(c1.HOUR)+":"+c1.get(c1.MINUTE)+":"+c1.get(c1.SECOND));
}
} 展开
public class CalendarDemo
{
public static void main(String [] args)
{
Calendar c1=Calendar.getInstance();
System.out.println(c1.get(c1.YEAR)+"year"+(c1.get(c1.MONTH)+1)+"month"+c1.get(c1.DAY_OF_MONTH)+"day"+c1.get(c1.HOUR)+":"+c1.get(c1.MINUTE)+":"+c1.get(c1.SECOND));
c1.add(c1.DAY_OF_YEAR,230);
System.out.println(c1.get(c1.YEAR)+"year"+(c1.get(c1.MONTH)+1)+"month"+c1.get(c1.DAY_OF_MONTH)+"day"+c1.get(c1.HOUR)+":"+c1.get(c1.MINUTE)+":"+c1.get(c1.SECOND));
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询