How polymorphism is implemented in java?

java, oop, polymorphism

Solution

vtables, as described at https://wikis.oracle.com/display/HotSpotInternals/VirtualCalls

[edit Tomasz makes a good point in the question comments - this is for Oracle's hotspot]

Problem

In Java all public non static methods are virtual. This means that which method to call is decided on run time(dynamic binding). In C++ virtual functions (dynamic binding) is implemented by using vpointer and vtable. I want to know that how this is implemented by Java. Does Java also use vpointer and vtable like C++ or some other technique to know which method to call on run time?

Original source

Related problems