...
OOPS
August 29, 2024
OOPS
August 29, 2024
OOPS
August 29, 2024
OOPS
August 29, 2024

OOPS

Question 121
​ To override a method in java, we need to define a method in a subclass with the
A
Same name, same number of arguments having the same data types as a method in the superclass
B
Different name, same number of arguments having the same data types as a method in the superclass
C
Same name but different number of arguments as a method in the superclass
D
Same name, same number of arguments but different data types as a method in the superclass
Question 121 Explanation: 
●The argument list should be exactly the same as that of the overridden method.
● The return type should be the same or a subtype of the return type declared in the original overridden method in the superclass.
Correct Answer: A
Question 121 Explanation: 
●The argument list should be exactly the same as that of the overridden method.
● The return type should be the same or a subtype of the return type declared in the original overridden method in the superclass.

Leave a Reply

Your email address will not be published. Required fields are marked *