import java.sql.Timestamp; import java.util.Date; public class TimeTest { // Method that returns a Timestamp // object. public static Timestamp getCurrentTime() { // Instantiates a Date object and calls // the getTime method, and creates and // returns the Timestamp object with the // current time. In one line! return new Timestamp(new Date().getTime()); } //The main method that calls the // getCurrentTime method and returns // the Timestamp object and prints // to screen public static void main(String[] args) { System.out.println(getCurrentTime()); } }