invokevirtual
INVOKEVIRTUAL is an instruction in the Java Virtual Machine (JVM) bytecode. It is used to invoke an instance method on an object. The JVM determines at runtime which specific method implementation to execute based on the actual class of the object, rather than the declared type of the variable. This dynamic dispatch mechanism is a core feature of object-oriented programming and is fundamental to polymorphism in Java.
When the JVM encounters an INVOKEVIRTUAL instruction, it looks at the object reference on the operand stack.
INVOKEVIRTUAL is distinct from instructions like INVOKESTATIC (for static methods) and INVOKESPECIAL (for constructors, private methods,