Making a run-time decision about which instance method to call is known as:
Answers
Answered by
1
ob.methB(); // Compile Time Error
}
}
This will produce a Compile Time Error that method methB() not found in class A, although Object Reference "ob" contains an object of class B which consists of method methB(). Reason for this is that Java Compiler checks for the method in Class A (the reference type) not in Class B (the actual object type). So, I want to know whats the reason behind this. Why does Java Compiler looks for the method in Class A why not in Class B(the actual object type)?
}
}
This will produce a Compile Time Error that method methB() not found in class A, although Object Reference "ob" contains an object of class B which consists of method methB(). Reason for this is that Java Compiler checks for the method in Class A (the reference type) not in Class B (the actual object type). So, I want to know whats the reason behind this. Why does Java Compiler looks for the method in Class A why not in Class B(the actual object type)?
Similar questions
Business Studies,
8 months ago
Biology,
8 months ago
Social Sciences,
8 months ago
Political Science,
1 year ago
History,
1 year ago
Math,
1 year ago