Multiple choice technology web technology

Given: class Top { public Top(String s) { System.out.print("B"); } } public class Bottom2 extends Top { public Bottom2(String s) { System.out.print("D"); } public static void main(String [] args) { new Bottom2("C"); System.out.println(" "); } } What is the result?

  1. BD

  2. DB

  3. BDC

  4. DBC

  5. Compilation fails

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

When a superclass lacks a no-argument constructor, subclasses must explicitly call a superclass constructor with matching arguments using super(...). Bottom2 fails to do this, causing compilation to fail because the implicit super() call cannot find a valid constructor in Top. The Top class only has Top(String s), so Bottom2's constructor must explicitly call super(s) or super(someString).