Posts

Showing posts from November 8, 2010

Thread Life Cycle in java

Image
Thread Life Cycle -      In the following figure, we are describing about Thread Life Cycle. 1) Create Thread – Thread can be create through Thread Class or Runnable interface. 2) New State – when any object of thread is being made by new Thread() 3) Runnable – When start method of thread is called means thread is now in runnable state. 4) Running – After Runnable state, based on the priorities of thread, is being to running state. 5) Dead – After running state, thread will go to Dead. Or it can be block states. 6) Block States – Thread can be in block state by calling wait(), sleep(), join() methods. 7) Sleep State – when sleep() method is called by thread, thread will go to the sleep state. Sleep State means, This thread is still alive and it can be go on runnable state. Thread has sleep method for passing the time in millisecond. And throw InterruptedException.     static void sleep(long millisecond) throws InterruptedException  8) Wait State

Recent Post

Recent Posts Widget