For an example, if we have some variable in run method, and
we created one or more threads. Does all threads will share
the same variable or a copy of variable is created for each
thread??
Answer / ranganathkini
No, each thread will have its own copy of the variable.
The reason is that run() is a method and any variable
declared inside a method is considered a local method and
its scope remains only within that method. If new thread
instances are spawned then each thread instances' run()
method will have their own copy of the variable.
| Is This Answer Correct ? | 3 Yes | 0 No |
What is the difference between long.class and long.type?
What is the return type of interrupt method?
wahts is mean by dynavalidatorform in struts/
hi, All are saying that now software field position is not good and in 5-10yrs total software field ll be saturated . is it true? i am unable decide ii continue in this field or not please tell me?
Difference between sleep and suspend?
What is a policy?
How we set Bean Id when we are creating web application using SpringMVC and Hibernet Integration
What is difference RMI registry and OSAgent?
Why do I get a duplicate name error when loading a jar file?
What class is the top of the awt event hierarchy?
types of exceptions
what are the activation groupworks?