当前位置: 代码迷 >> 综合 >> 第三周Q5问题
  详细解决方案

第三周Q5问题

热度:6   发布时间:2024-02-22 04:49:07.0

问题描述: 

Q5 (Use the GregorianCalendar class) Java API has the GregorianCalendar class in the java.util package, which you can use to obtain the year, month, and day of a date. The no-arg constructor constructs an instance for the current date, and the methods get(GregorianCalendar.YEAR), get(GregorianCalendar.MONTH), and get(GregorianCalendar.DAY_OF_MONTH) return the year, month, and day.

Write a program to perform two tasks:

  • Display the current year, month, and day.
  • The GregorianCalendar class has the setTimeInMillis(long) , which can be used to set a specified elapsed time since January 1, 1970. Set the value to 1234567898765L and display the year, month, and day.

 

 

 

 

 

 

 

  相关解决方案