Mark As Completed Discussion

Build your intuition. Click the correct answer from the options.

What is the console output of the below code snippet?

1class A {
2    public void methodCall() {
3        System.out.println("Call from A");
4    }
5}
6
7class B extends A {
8    public void methodCall() {
9        System.out.println("Call from B");
10    }
11}
12
13public class Main {
14    public static void main(String[] args) {
15        A a = new B();
16        a.methodCall();
17    }
18}

Click the option that best answers the question.

  • Call from A
  • Call from B
  • Call from A Call from B
  • Error