Three of the methods are incorrectly declared, which are they?
public abstract class Tester {
public void test1();
public final void test2() {};
public static void test3() {};
public abstract static void test4();
public abstract final void test5();
}
-
test1, test2 and test4
-
test2, test4 and test5
-
test1, test4 and test5
-
test1, test2 and test3
C
Correct answer
Explanation
test1 fails: abstract methods can't have bodies in abstract classes. test4 fails: abstract methods can't be static. test5 fails: abstract methods can't be final. test2 and test3 are valid: abstract classes can have final and static methods with implementations. Option C correctly identifies the three invalid declarations.