Code comes up with main as the thread name.Even though the main thread is still running dosen't Thread.currentThread(); see the context in which it is being called?
Code:class T extends Thread{ public T(String tname){ super(tname); } public void run(){ Thread t = Thread.currentThread(); String tname = t.getName(); boolean isalive = t.isAlive(); for(int i = 1; i <= 10; ++i){ System.out.println(tname + " is alive ?" + " : " + isalive); } } }




Even though the main thread is still running dosen't Thread.currentThread(); see the context in which it is being called?
Reply With Quote