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
A method
is nothing but a set of instructions. Whichever thread calls the method, get a copy of those instructions. After that the execution begins. The method may use local variables which are method and thread-scoped
, or it may use shared resources, like static resources, shared objects or other resources, which are visible across threads
.