Source of ClockTest.java


  1: public class ClockTest
  2: {
  3:         /** Test driver to exercise the AlarmClock class */
  4:         public static void main(String args[])
  5:         {
  6:                 Clock myClock = new Clock(12, 30, 0);
  7:                 System.out.println(myClock.toString());
  8: 
  9:                 //Change the alarm time
 10:                 myClock.setHour(7);
 11:                 System.out.println(myClock.toString());
 12: 
 13:                 //Create another AlarmClock object and test equals
 14:                 Clock mySecondClock = new Clock();
 15: 
 16:                 if(myClock.equals(mySecondClock))
 17:                         System.out.println("The Clocks are equal!");
 18:                 else
 19:                         System.out.println("The Clocks are not equal!");
 20: 
 21:         }
 22: }