Single Choice Not Set

Q
class MyClass{
      MyClass(){
            System.out.print("one");
      }
      public void myMethod(){
            this();
            System.out.print("two");
      }
}
 
public class TestClass{
      public static void main(String args[]){
            MyClass obj = new MyClass();
            obj.myMethod();
      }
}
which one is correct

ID: #2189 Java Constructor and Methods 904 views
Question Info
#2189Q ID
Not SetDifficulty
Java Constructor and MethodsTopic

Choose the Best Option

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

  • A two one one
  • B one one two
  • C one Exception
  • D Compilation Error
Correct Answer

Explanation

Compilation Error

Share This Question

Challenge a friend or share with your study group.