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 2 Method 1 None of these Compile time error as final method can't be overloaded Method 2 Method 1 None of these 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 5 B 8 A B 8 B 8 A 5 None of these A B 5 A 5 B 8 A B 8 B 8 A 5 None of these A B 5 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)); } } 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 The sum of x and y is 9 None of these The sum of x and y is 45 ANSWER DOWNLOAD EXAMIANS APP
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 None of these 2.0 Compile time error 0 None of these 2.0 Compile time error ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the expected output?class Animal {Animal() {System.out.println("Animal");}}class Wild extends Animal{Wild() {System.out.println("Wild");super();}}public class Test {public static void main(String args[]) {Wild wild = new Wild();}} Runtime Exception Animal Wild Wild Animal Compilation Error Runtime Exception Animal Wild Wild Animal Compilation Error ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The implicit return type of a constructor is void None of these A class object in which it is defined. There is no return type. void None of these A class object in which it is defined. There is no return type. ANSWER DOWNLOAD EXAMIANS APP