// Simple program that creates a static method and calls it. // Modified from a small program in Thinking in Java by Eckel // Distributed under the GNU GPL: www.gnu.org // import java.util.*; import java.util.Date; public class HelloDate { public static void main(String[] args0) { String charlie, echo; Date delta = new Date(); System.out.println("Calling the dateMethod now"); // calling the static method 'dateMethod' and placing // results into 'charlie' charlie = dateMethod(); System.out.println("Printing the results of the dateMethod."); // printing the results of the dateMethod System.out.println(charlie); System.out.println("The getTime() method result: " + delta.getTime()); } // end main method // start definition of the static method 'dateMethod' static String dateMethod() { System.out.println("Now executing the dateMethod below."); // creating new Date() object Date alpha = new Date(); // placing method results into 'bravo' String bravo = "Hello world it is: " + alpha; // returning 'bravo' to point where method was called return bravo; }// end dateMethod } // end class