Multiple choice

What will be the output of java MyClass,java? class Base {
public static void main(String[] args) {
System.out.println(In Base Class );
}
}
public class MyClass extends Base { }

  1. compile time error

  2. run time error

  3. execute successfully with no output

  4. prints In Base Class

  5. none of these

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

When we run stand alone java program, the main method of that class is called. If main method is not present in that class, java runtime system calls the inherited method from parent class.