Does each instance of a class have its own copies of instance methods
in the same way it has its own copies of instance variables?
Every time you instantiate a class, new memory is allocated to store
the object. Part of this storage includes space for copies of its
member variables. Rather than create a new copy of each method
into a class instance, which would be rather expensive, a virtual
lookup table mapping methods to code blocks is allocated.
think of class methods as functions that take an invisible argument
that references the invoking instance, i.e., the this reference.
That makes it possible to store methods independent of instantiated
classes. When a class instance invokes a method, a lookup is
performed in its virtual function table to find the proper code
block to execute.
Therefore, all class intances share the same code,
but have their own data. Novel runtime optimization techniques have
been applied to improve the performance of virtual function lookups in
Java so that you only pay a lookup penalty the first time you invoke