Originally posted by Dishi Malhotra: t1 = new Thread(); t1 = null; t1.start();
So you create a new thread. They you take way the only reference to it by setting the variable referencing it to mull. Then you start it??? Perhaps I am missing something, but looks to me like t1 is food for the gc().
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Dec 13, 2000
Candy i can't get u what u want to say so plz explain
Hi Dishi What Cindy was trying to say ... when you say t1 = new Thread(); a new Thread Object is created referenced by t1. immediately you are setting this t1 to null which means there is no object associated with t1 now when you say this t1 = null; After that you are trying to call a method start() [t1.start()] for this reference which doesnot have any association with any object. So as a result you get a NullPointerException when u try to access this function. During the course of time, since the Thread object created has no reference, this will be destroyed by GarbageCollector. Hope this clears your doubt cheers Siva Prasad [This message has been edited by Siva Prasad (edited March 07, 2001).]