hello,

I know that in C++ every time I have a "virtual" method or I derive from a class with virtual method, compiler creates a Vtable for each class:
Qt Code:
  1. class Instrument {
  2. virtual play() { ................}
  3. };
  4.  
  5. class Guitar: public Instrument {
  6. play() { playNote(); } //1
  7. };
  8.  
  9. Instrument* i = new Guitar();
  10. i-> play(); //call 1
To copy to clipboard, switch view to plain text mode 
Here compiler builds two Vtable, for Instrument and for Guitar (it doens't clear why a vtable for Instrument)....)

However, what does java do? I mean, I know all methods are "virtual" in java by default; then every class has it's vtable by default? Or the vtable is created only at the moment compiler/interpreter see something like "
Instrument* i = new Guitar();"

thanks,