Q13. Explain life cycle of a Thread?


Ans.   Once we create a Thread object then the Thread is said to be in New/Born state once we call t.start() method now the Thread will be entered into ready/Runnable state that is Thread is ready to execute. If Thread Scheduler allocates CPU now the Thread will entered into the Running state and start execution of run() method. After completing run() method the Thread entered into Dead State.

Q14. What is the importance of Thread class start() method?
Ans.    Start() method present in Thread class performing all low level joining formalities for the newly created thread like registering thread with Thread Scheduler etc and then start() method invoking run() method.As the start() method is doing all low level mandatory activities, Programmer has to concentrate only on run() method to define the job. Hence, start() method is a big assistant to the programmer.Without executing Thread class start() method there is no chance of starting a new Thread.
Q15. After starting a Thread if we trying to restart the same thread once again what will happen?
Ans.  After starting a Thread restarting of the same Thread once again is not allowed violation leads to Runtime Exception saying IllegalThreadStateException.
Q16. Explain Thread class constructors?
Ans.  There are eight constructors are available in Thread class:
1. Thread t=new Thread();          
2. Thread t=new Thread(Runnable r);    
3. Thread t=new Thread(String name);  
4.Thread t=new Thread(Runnable r, String name);          
5.Thread t=new Thread(ThreadGroup g, String name);  
6.Thread t=new Thread(ThreadGroup g, Runnable r);    
7.Thread t=new Thread(ThreadGroup g, Runnable r, String name);         
8.Thread t=new Thread(ThreadGroup g, Runnable r, String name, long stacksize);