Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please only Use Netbeans Programming Exercises 3 9,5 (Use the class the class in

ID: 3573797 • Letter: P

Question


Please only Use Netbeans

Programming Exercises 3 9,5 (Use the class the class in the java.util package. which you can use to obtain the year, month. and day of dite.The no-arg constructor constructs an instance for the current date, and the meth- get get Gregoriancalendar.NovTH) and get Gregoriancalendar.DAY 0F MONTH) retum the year. month, and day. Write a program to perform two tasks Display the current year, month, and day. The Gregoriancalendar elass has the setTime InMillis(long), which can be used to set a specified elapsed time since January l, 1970. Set the value to 1234567898765 L. and display the year. month, and day

Explanation / Answer

Hi, Please find my implementation.

Please let me know in case of any isue.

import java.util.GregorianCalendar;

public class GregorianCalendarDemo {

  

   public static void main(String[] args) {

      

       GregorianCalendar gregorianCalendar = new GregorianCalendar();

      

       String month=String.valueOf(gregorianCalendar.get(GregorianCalendar.MONTH));

       String day=String.valueOf(gregorianCalendar.get(GregorianCalendar.DAY_OF_MONTH));

       String year=String.valueOf(gregorianCalendar.get(GregorianCalendar.YEAR));

      

       System.out.println("Current Month: "+month);

       System.out.println("Current Year: "+year);

       System.out.println("Current Day: "+day);

   }

}

/*

Sample run:

Current Month: 11

Current Year: 2016

Current Day: 7

*/

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote