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 Posted / 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 |
Post New Answer View All Answers
What is a policy?
How substring() method of string class create memory leaks?
Difference between hashmap and hashtable?
What are the diff types of exception?
A user of a web application sees a jsessionid argument in the URL whenever a resource is accessed. What does this mean? a. The form must have the field jsessionid b. URL rewriting is used as the session method c. Cookies are used for managing sessions
What are externizable interface?
What is abstract schema?
Can I run seam outside of jboss as?
Explain about thread synchronization inside a monitor?
What do you mean by Socket Programming?
What is the difference between system.out ,system.err and system.in?
What is ioc concept & explain it?
Can you give me a simple example of using the requiredif validator rule?
What is permgen or permanent generation?
Define aop(assepct oriented programing)?