Q:

Java Program to print current time

0

Java Program to print current time

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import java.util.*;
import java.lang.*;
import java.io.*;

public class GetCurrentDateAndTime
{
   public static void main(String args[])
   {
      int second, minute, hour;
      GregorianCalendar date = new GregorianCalendar();
      second = date.get(Calendar.SECOND);
      minute = date.get(Calendar.MINUTE);
      hour = date.get(Calendar.HOUR);
      System.out.println("Current time is  "+hour+" : "+minute+" : "+second);
   }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now