I would like to known if each instance of a class has its own copy of the methods in that class?
Lets say, I have following class MyClass
:
p
'Instance Variables are not thread safe' - this statement depends on the context. It is true, if for example you are talking about Servlets. It is because, Servlets create only one instance and multiple threads access it. So in that case Instance Variables are not thread safe.
In the above simplified case, if you are creating new instance for each thread, then your instance variables are thread safe.
Hope this answers your question