JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? public Test(void) None of these Test(void) Test( ) public Test( ) public Test(void) None of these Test(void) Test( ) public Test( ) ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor? 1 and 3 public MyClass(void){} MyClass(){} public MyClass(){} MyClass(void) {} 1 and 3 public MyClass(void){} MyClass(){} public MyClass(){} MyClass(void) {} 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 one Exception None of these two one one one one two Compilation Error one Exception None of these two one one 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 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 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 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods class A{ A(String s){} A(){}}1. class B extends A{2. B(){}3. B(String s){4. super(s);5. }6. void test(){7. // insert code here8. }9. }Which of the below code can be insert at line 7 to make clean compilation ? A a = new B(5); None of these A a = new A(String s); All of these A a = new B(); A a = new B(5); None of these A a = new A(String s); All of these A a = new B(); ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods In which area of memory, the system stores parameters and local variables whenever a method is invoked? Array Storage Area Heap Stack Array Storage Area Heap Stack ANSWER DOWNLOAD EXAMIANS APP