Multiple choice technology programming languages

package simplejava; public class TestConstructor2 { int p; TestConstructor2() { System.out.print(" I am in Constructor"); } TestConstructor2(int p) { this(); this.p = p; System.out.print(" p = " + p); } public static void main(String[] args) { TestConstructor2 tp1 = new TestConstructor2(10); } }

  1. I am in Constructor p = 10

  2. I am in Constructor p = 0

  3. Compiler Error

  4. Exception

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

The parameterized constructor correctly calls this() as its first statement, executing the no-arg constructor first. It prints 'I am in Constructor', then assigns p and prints 'p = 10'. The output is the concatenation of both print statements.