OOPS
August 29, 2024OOPS
August 29, 2024OOPS
|
Question 121
|
To override a method in java, we need to define a method in a subclass with the
|
Same name, same number of arguments having the same data types as a method in the superclass
|
|
|
Different name, same number of arguments having the same data types as a method in the superclass
|
|
|
Same name but different number of arguments as a method in the superclass
|
|
|
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.
● 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.
● The return type should be the same or a subtype of the return type declared in the original overridden method in the superclass.
