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 |
Is System.err.println(""Statement"); is execute the output on console . Example: System.err.println("Hello JAVA");
how can u cal servlet from java?
what are the software's needed to develop advanced java 3 tier application project
What are the call back methods in entity bean?
what is Activation Instantinator?
Why use POJO when I can use hashmap
how the mapping can be done from jsp to actionservlet?
Is jvm a overhead?
What are skeletons and stubs and how they are generated?
When a thread terminates its processing, it enters into what state?
Explain the stub's and skeleton's functionality?
What are externizable interface?