Multiple choice technology programming languages

Select correct answer Given: Class A{ A(){ System.out.print(“A”); } } Class B extends A{ B(){ this(4); super(); System.out.print(“B”); } B(int i){ System.out.print(“C”); } }

  1. Does not compile

  2. prints "ABC"

  3. prints "ACB"

  4. prints "CAB"

  5. run time exception

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

In Java, either this() or super() can be the first statement in a constructor, but never both. The no-arg B() constructor attempts to call this(4) followed by super(), which violates Java's constructor chaining rules. Since this(4) must be first and it will implicitly call super(), the explicit super() call causes compilation failure.