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 ? All of these None of these A a = new B(); A a = new B(5); A a = new A(String s); All of these None of these A a = new B(); A a = new B(5); A a = new A(String s); ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor? public MyClass(){} public MyClass(void){} MyClass(void) {} 1 and 3 MyClass(){} public MyClass(){} public MyClass(void){} MyClass(void) {} 1 and 3 MyClass(){} ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the output of the program?class Test{ public int display(int x, int y){ return ("The sum of x and y is " + x + y); } public static void main(String args[]){ Test test = new Test(); System.out.println(test.display(4,5)); } } The sum of x and y is 9 None of these The sum of x and y is 45 does not compile The sum of x and y is 9 None of these The sum of x and y is 45 does not compile ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The implicit return type of a constructor is A class object in which it is defined. None of these void There is no return type. A class object in which it is defined. None of these void There is no return type. ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The finalize() method is called just prior to An object, variable or method goes out of scope. None of these Before garbage collection. A variable goes out of scope. An object or variable goes out of scope. An object, variable or method goes out of scope. None of these Before garbage collection. A variable goes out of scope. An object or variable goes out of scope. 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? Stack Storage Area Heap Array Stack Storage Area Heap Array ANSWER DOWNLOAD EXAMIANS APP