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);}} None of these Method 1 Compile time error as final method can't be overloaded Method 2 None of these Method 1 Compile time error as final method can't be overloaded Method 2 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Which of the modifier can't be used for constructors? static protected public private static protected public private 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); }} 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 A 5 B 8 A B 8 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The implicit return type of a constructor is void There is no return type. 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 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 Wild Animal Compilation Error Animal Wild Runtime Exception Wild Animal Compilation Error Animal Wild 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); }} Compilation clean but throws RuntimeException int None of these long Compilation fails Compilation clean but throws RuntimeException int None of these long Compilation fails ANSWER DOWNLOAD EXAMIANS APP