Single Choice Not Set

Qwhich one is correct:
class MyClass{
	int i;
	int j;

	public MyClass(int i, int j){
		this.i = i;
		this.j = j;
	}

	public void call(){
		System.out.print("One");
	}
}

public class Test{
	public static void main(String args[]){
		MyClass m = new MyClass(); //line 1
		m.call(); //line 2
	}
}

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

Choose the Best Option

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

  • A One
  • B Compilation fails due to an error on line 1
  • C Compilation fails due to an error on line 2
  • D Compilation succeed but no output.
Correct Answer

Explanation

Compilation fails due to an error on line 1

Share This Question

Challenge a friend or share with your study group.