JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? None of these public Test(void) Test(void) Test( ) public Test( ) None of these public Test(void) Test(void) Test( ) public Test( ) ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What will be the return type of a method that not returns any value? None of these void int double None of these void int double ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The implicit return type of a constructor is void A class object in which it is defined. None of these There is no return type. void A class object in which it is defined. None of these There is no return type. ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The main method should be static for the reason It can be accessed by every method or variable without any hindrance. None of these It can be accessed easily by the class loader. It can be executed without creating any instance of the class. It can be accessed by every method or variable without any hindrance. None of these It can be accessed easily by the class loader. It can be executed without creating any instance of the class. ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Determine output:public class Test{ public static void main(String args[]){ MyClass obj = new MyClass(); obj.val = 1; obj.call(obj); System.out.println(obj.val); }}class MyClass{ public int val; public void call(MyClass ref){ ref.val++; }} 1 Compilation Error None of these 2 3 1 Compilation Error None of these 2 3 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The following code contains one compilation error, find it?public class Test {Test() { } // line 1static void Test() { this(); } // line 2 public static void main(String[] args) { // line 3Test(); // line 4}} At line 3, compilation error, ambiguity problem, compiler can't determine whether a constructor At line 1, constructor Tester must be marked public like its class At line 4 At line 2, constructor call At line 3, compilation error, ambiguity problem, compiler can't determine whether a constructor At line 1, constructor Tester must be marked public like its class At line 4 At line 2, constructor call ANSWER DOWNLOAD EXAMIANS APP