MCQ Single Best Answer Not Set

QThe following code contains one compilation error, find it?
public class Test {
	Test() {    }  // line 1
	static void Test() {  this(); } // line 2  
	public static void main(String[] args) { // line 3
		Test(); // line 4
	}
}

ID: #2169 Java Constructor and Methods 1,534 views
Question Info
#2169Q ID
Not SetDifficulty
Java Constructor and MethodsTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A At line 1, constructor Tester must be marked public like its class
  • B At line 2, constructor call
  • C At line 3, compilation error, ambiguity problem, compiler can't determine whether a constructor
  • D At line 4
Correct Answer: Option B

Explanation

At line 2, constructor call

Share This Question

Challenge a friend or share with your study group.