Suppose If we have variable " I " in run method, If I can create one or More thread each thread will occupy a separate copy or same variable will be shared ?

Suppose If we have variable " I " in run method, If I can create one or More thread each thread will occupy a separate copy or same variable will be shared ?

If we have a local variable declared in the run method then all the existing thread will hava a separate copy for that variable. If we are using the instance variable in the run method then this will be shared by all the existing variable.

By:Jalees
Date:2014-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher