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 ioc concept & explain it?
What is the relationship between an event-listener interface and an event-adapter class?
Explain the difference between object state and behavior?
whats is mean by connectionpooling
how to make a index.jsp for running the site in internet and find an error for connection with weblogic server and java that give an error invalid object name.and how to maintain session.
What is the difference between the session.update() method and the session.lock() method?
If we opened Windows Internet Explorer 4 times, does it starts 4 processes or 4 threads?
what is an isolation level?
Define the remote object implementation?
What is TL and its use?
cud u help me ... i am struggling with this question... to find all the subsets of a given set for ex.... a,,b,c shud give all the subsets.... i gt the program in c bt nt able to get it in java..... help needed ..
What do you know about seam?
What are externizable interface?
What is permgen or permanent generation?
What is mdb and what is the special feature of that?