JAVA Constructors and Methods What is the output of the above program ?class Num { Num(double x ){ System.out.println( x ) ; } }public class Test extends Num { public static void main(String[] args){ Num num = new Num( 2 ) ; } } 0 2.0 None of these Compile time error 0 2.0 None of these Compile time error ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the output for the below code?public class Test{ public static void printValue(int i, int j, int k){ System.out.println("int"); } public static void printValue(byte...b){ System.out.println("long"); } public static void main(String... args){ byte b = 9; printValue(b,b,b); }} long Compilation clean but throws RuntimeException int Compilation fails None of these long Compilation clean but throws RuntimeException int Compilation fails None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The finalize() method is called just prior to None of these An object, variable or method goes out of scope. An object or variable goes out of scope. A variable goes out of scope. Before garbage collection. None of these An object, variable or method goes out of scope. An object or variable goes out of scope. A variable goes out of scope. Before garbage collection. ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Which of the modifier can't be used for constructors? static private public protected static private public protected 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 ? All of these A a = new B(5); None of these A a = new A(String s); A a = new B(); All of these A a = new B(5); None of these A a = new A(String s); A a = new B(); 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 The sum of x and y is 45 None of these does not compile The sum of x and y is 9 The sum of x and y is 45 None of these does not compile ANSWER DOWNLOAD EXAMIANS APP