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
Which is faster set or list in java?
Can we use String with switch case?
Can a class be declared as protected?
Does .length start 0 java?
Who developed java?
What is the difference between inner class and nested class?
How to use string tokenizer class.
What does system out println () do?
What is the purpose of the finally clause of a try-catch-finally statement in java programming?
What are the different tags provided in jstl?
What is difference between this and super keyword?
Can we extend a class with private constructor?
What is meant by call by reference?
What is jit compiler in java?
How can I debug the Java security exceptions and AccessControlExceptions?