Shubham Semwal wrote:That's what made me confused. Objects being a runtime entity has no physical memory before execution. And as far as i know class is loaded(and methods) before execution so although an object can access the methods they do not contain them. Methods gets memory in class area and objects in heap so technically speaking objects have access to manipulation code and they do not contain that code within themselves.
Just wanted to clarify 
It seems that you're worrying a bit too much about mechanics here: the class is
the definition; the object is
the thing. Since it doesn't make much sense to copy
execution code (as opposed to data) for each instance, there is only one copy of
any method for a given class (although it's possible that there are exceptions).
I
think that instance methods differ from
static ones by having an implicit
this parameter added, but I'm not absolutely sure. It makes sense to me to imagine it that way though.
The details are almost certainly available in the JVM spec, but I'm afraid I'm not exactly sure where, since I've never had to worry about it (I did the
SCJP exam a while back, but I don't remember it being a big issue).
Winston