Interview Q&A / Object-Oriented Programming

IntermediateQuick answer1 min readUpdated 3 Oct 2026

What is dynamic method dispatch in Java?

SHORT ANSWER

It is the way Java chooses which overridden method to run at runtime, based on the actual object type and not on the type of the reference variable.

Explain it simply

A phone's contact says "Dad". Whatever name is on the screen, the call goes to the person actually holding the number. Likewise, a Shape variable may hold a circle or a rectangle, and the method that runs belongs to the real object found at runtime.

Example

java
class Notifier {
    void send(String msg) { System.out.println("Generic: " + msg); }
}
class SmsNotifier extends Notifier {
    @Override void send(String msg) { System.out.println("SMS: " + msg); }
}
class EmailNotifier extends Notifier {
    @Override void send(String msg) { System.out.println("Email: " + msg); }
}

Notifier n = new SmsNotifier();     // reference type Notifier, object type SmsNotifier
n.send("OTP 4821");                 // prints: SMS: OTP 4821
n = new EmailNotifier();
n.send("OTP 4821");                 // prints: Email: OTP 4821

The same call line produces different behaviour. That is runtime polymorphism.

What to say in the interview

"Dynamic method dispatch resolves overridden method calls at runtime using the object's actual class through the virtual method table. It is what makes a parent-type reference behave according to the child object it holds."

Common mistakes

  • Believing the reference type decides which overridden method runs. It decides only what you may call.

#polymorphism#java#overriding

Related questions

Practise more Object-Oriented Programming questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Object-Oriented Programming quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.