posted 18 years ago
The answer to your first question is yes, there is only one copy of the code for an instance method (or for any method,) which is "shared" by all the instances of that class.
The answer to your second question is "it depends" or, perhaps more appropriately, "it doesn't matter." The precise details of code storage and method lookup will vary by JVM implementation, by platform, even by JVM version; these details may be especially complex when a JIT or the HotSpot engine are in use, as there may be bytecode, native code, and optimized native code versions of any one method.
If you're interested, the source code for Sun's JVMs is available, and there are open-source JVMs like Kaffe you could look at as well. But really, you shouldn't care unless you're planning on implementing your own JVM.