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 sql exception class and sql warning class
In howmany ways a thread can be created?
Name the method to find, if a thread is active or not?
how can we load a file of a user in the database table?
i have a 1000 objects in data base i need to display those in jsp's how can i retrive those objects in jsp. (consider the performance issue)
can a static method be overridden
What is the map interface?
What is a session? Can you share a session object between different theads?
function of extends and implements keywords?
What is a tasks priority and how is it used in scheduling?
What is serialization and de-serialization ?
what is JTA ?