public class ThreadState {
public static void main(String[] args){
Thread t = new Thread(){
public void run(){
// infinite loop
while (true) {
try {
Thread.sleep(1000);
}
catch (InterruptedException e) {
}
System.out.println("thread is running..."+Thread.currentThread().toString());
}
}
};
t.start() ;
t = null ;
while (true) {
try {
Thread.sleep(3000);
}
catch (InterruptedException e) {
}
System.out.println("thread is running..."+Thread.currentThread().toString());
}
}
}
Thread instance t is initialized to null .. still it is able to run and prints its detail on the console . Need an explanation for this