Hi.. Is a seperate set of variables created in the run method for each call to the thread or the same copy shared?? Rather, if i have a variable 'x' in the run method, if I craete more than one thread, each thread will occupy a seperate copy or the same variable will be shared?? regards
It depends on the type of variable we're talking about. Instance variables are created with the object. Class variables are created with the class. Local variables are created every time a thread starts execution of a given method. It sounded to me like Rajeev was talking about local variables, but I'm not sure. If x is a local variable inside a run() method, then each time a new thread starts that method, it makes its own new copy of x. [ September 26, 2002: Message edited by: Jim Yingst ]
"I'm not back." - Bill Harding, Twister
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad:
a bit of art, as a gift, that will fit in a stocking