1.IN CASE OF DYNAMIC METHOD DISPATCH WHY WE USE REFERENCE
VARIABLE,WE CAN USE THE DIFFERENT DEFINED OBJECT DIRECTLY TO
ACCESS THE DATA MEMBER AND MEMBER FUNCTION OF THAT
RESPECTIVE CLASS?WHAT IS THE MAIN FUNCTION OF "REFERENCE
VARIABLE" HERE?

Answer Posted / vijay kumar

In case of dynamic method dispatch, It restricts from being used to call methods of other class. You cannot call overriden method which is not declared in reference variable class..
This is the main reason why we use reference variable here in dynamic polymorphism.

Hope i answer this question.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What was java originally called?

505


Is null a string?

550


What is difference between hashset and hashmap in java?

460


What is the difference between throw and throws in java?

548


Is void a data type in java?

522






How are observer and observable used in java programming?

541


Write a function for palindrome and factorial and explain?

654


How do you convert bytes to character in java?

531


What do you mean by light weight and heavy weight components?

551


Who is the owner of java?

535


Can there be an abstract method without an abstract class?

534


What does int argc char * argv [] mean?

514


What is a string what operation can be performed out with the help of a string?

504


What is difference between static and abstract class?

516


Is array primitive data type in java?

529