Java program to display current time

This is a program to display your current system time. Java provides a class called “Date” found in java.ulti.date;. We use the built in methods in this class to retrieve system time.
Firstly, we create objects for the class Date. Using this object, we access the built-in methods which help us get system’s current time. Methods that we will use to get current time are.

All the above methods return Hours,Minutes,Seconds respectively.
Program:

Output:
Output

The following two tabs change content below.