Multiple choice technology programming languages

package simplejava; public class TestConstructor { int p ; public void TestConstructor(int p) { this.p=p; } public static void main(String[] args) { TestConstructor tp = new TestConstructor(10); TestConstructor tp = new TestConstructor(); System.out.println("p = "+tp.p); } }

  1. Compiler Error

  2. Exception

  3. p = 0

  4. p=10

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

The class has two issues: (1) 'public void TestConstructor(int p)' is a regular method, not a constructor, because constructors have no return type - 'void' makes it a method. (2) The class lacks a no-arg constructor, but 'new TestConstructor()' tries to call one. Additionally, 'TestConstructor tp' is declared twice causing a duplicate variable error. Compilation fails.