guys i figured out the solution. but i am still confused that what actually is going on in the main method. we first created the Clock object. But for what purpose Thread.sleep(4000) and Thread.sleep(1000) is? as per my understanding we are running the thread for 4 seconds and than stopping it using "isStopped" and what about Thread.sleep(1000) again?