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.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">