Source of TestGreetings.java


  1: //TestGreetings.java
  2: //Accesses methods from package misc.greetings in various ways.

  4: //import misc.greetings.*;

  6: /*
  7: Since the misc.greetings package has exactly three classes in it,
  8: the above import statement is equivalent to the following three
  9: import statements:
 10: import misc.greetings.English;
 11: import misc.greetings.French;
 12: import misc.greetings.German;
 13: */

 15: public class TestGreetings
 16: {
 17:     public static void main(String[] args)
 18:     {
 19:         English.sayHello();
 20:         English.sayHi();
 21:         French.sayBonjour();
 22:         German.sayGutenTag();

 24:         /*
 25:         //The following fully-qualified method calls
 26:         //work without the above import statement.
 27:         misc.greetings.English.sayHello();
 28:         misc.greetings.English.sayHi();
 29:         misc.greetings.French.sayBonjour();
 30:         misc.greetings.German.sayGutenTag();
 31:         */
 32:         
 33:         /*
 34:         //The following method call works if you
 35:         //import just the required package class.
 36:         French.sayBonjour();
 37:         */
 38:     }
 39: }