它的无参构造方法构建一个当前日期的实例.....。编写程序执行两个任务:
下面是Java的源代码:
import java.util.GregorianCalendar;
import java.util.Scanner;
public class _05_使用GregorianCalender类 {
public static void main(String[] args) {
GregorianCalendar calendar = new GregorianCalendar();
showtime(calendar);
long a =1234567898765L;
calendar.setTimeInMillis(a);
System.out.println();
showtime(calendar);
}
public static void showtime(GregorianCalendar calendar){
System.out.print(calendar.get(GregorianCalendar.YEAR)+":");
System.out.print(calendar.get(GregorianCalendar.MONTH)+ ":");
System.out.print(calendar.get(GregorianCalendar.DAY_OF_MONTH));
}
}
大家在阅读题目的过程中,一定要将所需题目变量和方法列出来
|