Create a class named TimerAlarm that extends Thread and implements a timer. Do not use the built-in Timer class for this exercise. Your class constructor should take as input an integer named t representing time in milliseconds and an interface object named obj that defines a method named alarmAction( ) . You will need to define this interface. Every t milliseconds the class should invoke method obj.alarmAction( ). Add pause( ) and play( ) methods that disable and enable the invocation of alarmAction( ) . Test your class with code that increments and prints out a counter.
Sorry the answer is not available at the moment…
If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.
Spread the 'tradition of sharing'.