Which of the following is a legal return type of a method overriding the given method:
public Object myMethod () {...}
Select the best option. Select 1 option.
Correct Option is : C
Since the original method is returning Object, the Overriding method can return any object type because all classes in Java ultimately extend from Object.
Since 1.5, Java allows covariant return types, which means an overriding method can have its return type as any subclass of the original return type of the overridden method.