This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
What are the differences between CASE 2 and 3 , also What will be default thread names given to each of these threads, can we guareentee for any paricular thread naming order of these by jvm? Are there any similar ways to create threads .
In case 1 thread is created by creating a new class (MyThreadClass), implementing (overriding) it's run() method, creating object of this class and finally calling the start() method of this object.
In Case 2 thread object is created directly using Thread class, but by invoking Thread(Runnable obj) constructor. In this case the thread will execute run() method of obj, not it's own run() method. You have to remember that Thread class implements Runnable interface, so objects of Thread class can be used as 'Runnable' objects to start thread this way.