What about the output confused you? What did you think it would be?
Joined: Jan 26, 2004
new Thread(new A5(),"T2").run();
I thought it will be "T1T2T3". I think my Threads concept is not clear.
Joined: Oct 10, 2000
It's the difference between calling the run() method and calling the start() method. It's a little tricky since you need to implement a run() method.
To start a thread running you have to call the start() method. Calling run() just executes in the same thread.
Joined: Sep 24, 2003
The call to Thread.run() merely delegates to it's encapsulated Runnable.run(). No new thread is started - it all executes in the same thread.
Calling Thread.start() is a direction to the thread scheduler to start a new thread. The thread scheduler, at its own discretion, will execute by calling the Thread.run() method - this occurs in the new thread.