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 |
Difference Between java & javax
5 Answers Sun Microsystems, Wipro,
what is heepStored?
What is a modular application?
What is the difference between a stub and a skeleton?
9 Answers ABC, College School Exams Tests, Geoservices, Polaris, Qualcomm, Rajiv Gandhi College of Engineering and Technology RGCET, UTIITSL, Wipro,
What are the benefits of detached objects?
In a multitiered application which tier is the browser in?
What is the difference between session and entity beans?
What modifiers may be used with an inner class that is a member of an outer class?
int x=5,i=1,y=0; while(i<=5) { y=x++ + ++x; i=i+2; } System.out.println(x); System.out.println(y); System.out.println(i); How to solve this? Please explain!
what is the life cycle of jsp?
Explain the purposes of methods wait(), notify(), notifyAll ()?
In inglish: How to convert jar to exe files? Em português: Como converter arquivos .jar para .exe?