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 Compile time error None of these 2.0 0 Compile time error None of these 2.0 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? Test( ) public Test( ) public Test(void) None of these Test(void) Test( ) public Test( ) public Test(void) None of these Test(void) 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++; }} 3 Compilation Error 1 None of these 2 3 Compilation Error 1 None of these 2 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The finalize() method is called just prior to Before garbage collection. None of these A variable goes out of scope. An object or variable goes out of scope. An object, variable or method goes out of scope. Before garbage collection. None of these A variable goes out of scope. An object or variable goes out of scope. An object, variable or method goes out of scope. ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Determine Output:class A{public static void method(int i){System.out.print("Method 1");}public static int method(String str){System.out.print("Method 2");return 0;}}public class Test{ public static void main(String args[]){A.method(5);}} Compile time error as final method can't be overloaded Method 1 Method 2 None of these Compile time error as final method can't be overloaded Method 1 Method 2 None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What will be the result of compiling and running the given code?class A{ int b=10; private A(){ this.b=7; } int f(){ return b; }}class B extends A{ int b;}public class Test{ public static void main(String[] args){ A a = new B(); System.out.println(a.f()); }} Prints 0 Prints 7 Prints 10 None of these Compilation Fails Prints 0 Prints 7 Prints 10 None of these Compilation Fails ANSWER DOWNLOAD EXAMIANS APP