Given the following class definitions:
public class BaseMain { public BaseMain() { System.out.println("BaseMain constructor"); } public void someMethod() { System.out.println("BaseMain someMethod"); } } class Main extends BaseMain { public Main() { System.out.println("Main constructor"); } public void someMethod() { // comment System.out.println("Main someMethod"); } public static void main(String args[]) { Main b = new Main(); b.someMethod(); } }
What statement is needed at the comment line to generate the following output:
BaseMain constructor Main constructor BaseMain someMethod Main someMethod
c
The first answer is used only as the first statement of a constructor. The second answer generates a syntax error. The fourth option results in unbounded recursion.