JAVA Constructors and Methods The variables declared in a class for the use of all methods of the class are called None of these reference variables instance variables objects None of these reference variables instance variables objects 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 1, constructor Tester must be marked public like its class At line 3, compilation error, ambiguity problem, compiler can't determine whether a constructor At line 2, constructor call At line 4 At line 1, constructor Tester must be marked public like its class At line 3, compilation error, ambiguity problem, compiler can't determine whether a constructor At line 2, constructor call At line 4 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods 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(); }} one one two Compilation Error None of these one Exception two one one one one two Compilation Error None of these one Exception two one one ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? public Test( ) public Test(void) Test( ) None of these Test(void) public Test( ) public Test(void) Test( ) None of these Test(void) ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the output for the below code ?class A{ public A(){ System.out.println("A"); } public A(int i){ this(); System.out.println(i); }}class B extends A{ public B(){ System.out.println("B"); } public B(int i){ this(); System.out.println(i+3); }}public class Test{ public static void main (String[] args){ new B(5); }} A B 8 A B 5 A 5 B 8 B 8 A 5 None of these A B 8 A B 5 A 5 B 8 B 8 A 5 None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The main method should be static for the reason None of these It can be executed without creating any instance of the class. It can be accessed by every method or variable without any hindrance. It can be accessed easily by the class loader. None of these It can be executed without creating any instance of the class. It can be accessed by every method or variable without any hindrance. It can be accessed easily by the class loader. ANSWER DOWNLOAD EXAMIANS APP