In Java, can a subclass overload a method from its superclass?
A. Yes, as long as the method is marked as "private"
B. No, method overloading is not allowed in Java
C. No, method overloading is not supported
D. None of These
Answer: Option D
Solution (By Examveda Team)
Method overloading occurs when two or more methods in the same class (or subclass and superclass) have the same name but different parameter lists.In Java, a subclass can overload a method from its superclass by defining a method with the same name but a different parameter list.
Option A is incorrect because a method marked as
private in the superclass is not visible to the subclass, so it cannot be directly overloaded.Option B and C are incorrect because method overloading is a fundamental feature of Java and is fully supported.
Therefore, the correct answer is Option D: None of These since none of the given options correctly describe method overloading in Java.
Join The Discussion
Comments (1)
What is method overriding in Java?
A. Redefining a superclass method in a subclass
B. Defining a new method with the same name in a subclass
C. Making a method private in a subclass
D. Hiding methods in a superclass
What is the purpose of method overloading in Java?
A. Creating static methods
B. Hiding methods in a superclass
C. Redefining methods in a subclass
D. Defining multiple methods with the same name but different parameters
A. @OverrideMethod
B. @OverrideSuper
C. @Override
D. @OverrideParent
What happens when a subclass tries to override a final method from the superclass in Java?
A. The final method is hidden
B. It results in a compilation error
C. The final method becomes static
D. The final method is null

This question's answer is wrong