Choose the correct statement:
-
A final method in class X can be abstract if and only if X is abstract.
-
A private static method can be called only within other static methods in class X.
-
A protected method in class X can be overridden by any subclass of X.
-
A non-static public final method in class X can be overridden in any subclass of X.
Reveal answer
Fill a bubble to check yourself
C
Correct answer
Explanation
Protected methods in Java are accessible within the same package and to subclasses (even in different packages), and can be overridden by any subclass unless marked final. Option C is correct. Option A is wrong because final methods cannot be abstract. Option B is wrong because private static methods can be called from non-static methods too. Option D is wrong because final methods cannot be overridden.