A. To override a method, the method must be defined in the subclass using the same signature and compatible return type as in its superclass. B. Overloading a method is to provide more than one method with the same name but with different signatures to distinguish them. C. It is a compilation error if two methods differ only in return type in the same class. D. A private method cannot be overridden. If a method defined in a subclass is private in its superclass, the two methods are completely unrelated. E. A static method cannot be overridden. If a static method defined in the superclass is redefined in a subclass, the method defined in the superclass is hidden.

Which of the following statements are true?


A. To override a method, the method must be defined in the subclass using the same signature and compatible return type as in its superclass.
B. Overloading a method is to provide more than one method with the same name but with different signatures to distinguish them.
C. It is a compilation error if two methods differ only in return type in the same class.
D. A private method cannot be overridden. If a method defined in a subclass is private in its superclass, the two methods are completely unrelated.
E. A static method cannot be overridden. If a static method defined in the superclass is redefined in a subclass, the method defined in the superclass is hidden.

The correct answer is ABCDE


Java

Learn More Multiple Choice Question :