SensorPortListenerinterface and overrides the
stateChangedmethod. This class should be used to tell the program when the user wishes to stop the program.
Threadsubclass that controls motor movement and is managed by the listener. This means that the listener should tell the
Threadwhen to start and stop the motors.
Threads report that they have finished their assigned tasks.
notifyAllcarefully; a thread that is waiting on a certain monitor should not miss a
joinmethod. In other words, the
joinmethod that is provided in the leJOS NXJ library is useless. Make sure to take this into account when developing the functionality of the main program/thread.