what is dynamic method dispatch ?
Answer Posted / hasib reza
Determining at runtime, which overridden method to call, is called dynamic method dispatch.
This is how Java implements run-time polymorphism.
Whenever a method is called on an object reference,
Declared type of object reference is checked at compile time to make sure the method exists in declared class.
At run time, the super class objects reference could refer to an instance of any subclass of the declared reference type.
When an overridden method is called through a super class reference,
Java determines which version of that method to execute based upon the type of object being referred.
When different types of objects are referred to,
Different versions of an overridden method will be called.
It is the type of the object being referred to
Not the type of the reference variable
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is a parameter in java?
Can we nested try statements in java?
What is a instance variable in java?
What is the difference between processes and threads?
How do you sort arraylist in descending order?
What are the two parts of a conditional statement?
What is the difference between variable declaration and variable initialization?
What is high level language in computer?
What is overloading and overriding in java?
What is are packages?
Can interface be private in java?
What is bifunction in java?
What is java dot?
Is 0 true or false?
Tell me the latest versions in java related areas?