what is dynamic method dispatch ?

Answer Posted / ramya

Dynamic method dispatch is the process the Java runtime
system uses to determine which method implementation to call
in an inheritance hierarchy. For example, the Object class
has a toString() method that all subclasses inherit, but the
String class overrides this method to return its string
content. If a String or other object type is assigned to an
Object reference using application logic, the Java compiler
cannot know in advance where a call to the toString() method
will be resolved, it must be determined dynamically at runtime.

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you extend main method in java?

617


What is the use of math abs in java?

547


Define an abstract class with reference to java.

574


How does a cookie work in Servlets?

348


Define how objects are stored in java?

563






What is valid keyword in java?

556


Can I declare class as static or private?

541


What is meant by class loader? How many types are there? When will we use them?

505


What are extraneous variables examples?

523


Objects or references which of them gets garbage collected?

532


Write a program to print 15 random numbers using foreach of java 8?

543


What is hasnext in java?

577


4.1 Supply contracts (in the form of comments specifying pre- and post conditions) for the enqueue() method of the LinkedQueue class given in the Appendix. (2) 4.2 Let Thing be a class which is capable of cloning objects, and consider the code fragment: Thing thing1 = new Thing(); //(1) Thing thing2 = thing1; //(2) Thing thing3 = (Thing) thing1.clone(); //(3) Explain how the objects thing2 and thing3 differ from each other after execution of the statements. (

1407


What is dot operator?

574


what is the difference between the methods sleep() and wait()? : Java thread

515