currentThread() is a static method of class Thread.
It returns the reference to the current executing object of class Thread.
How do you want to call this reference to the current executing object of class Thread? Let's say t.
Thread t = Thread.currentThread();
After this statement t holds a reference to the current executing thread (i.e. the current executing object of class Thread).
Do you want to change the name to the reference? No problem. Let's say iAmTheCurrentThread
ah..you asked why is required.
it's required because in multithreading programming you want to know what is the current thread executing, because you want interact with it, for example for changing its state, or getting its name,.
Joined: Dec 12, 2008
Thank you very much for the explaination.
Is there any alternate easy way to write the same.
How does it differ from
Thread t=new Thread();