Multiple choice technology programming languages

class A{ int b=10; private A(){ this.b=7; } int f(){ return b; } } class B extends class A{ int b; } class Test{ public static void main(String args[]){ A a=new B(); System.out.println(a.f()); } }

  1. Does not compile

  2. prints 0

  3. prints 10

  4. prints 7

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

The code fails to compile due to two errors: (1) 'class B extends class A' - should be 'class B extends A' without the word 'class' before A, and (2) class A has a private constructor, so it cannot be instantiated in main(). The code has multiple compilation errors preventing it from running.