JAVA Constructors and Methods What will be the return type of a method that not returns any value? None of these int double void None of these int double 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++; }} 2 1 3 Compilation Error None of these 2 1 3 Compilation Error 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();}} Animal Wild Wild Animal Compilation Error Runtime Exception Animal Wild Wild Animal Compilation Error Runtime Exception 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(){} 1 and 3 MyClass(void) {} public MyClass(){} public MyClass(void){} MyClass(){} 1 and 3 MyClass(void) {} 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)); } } 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 The sum of x and y is 9 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 Compile time error None of these 2.0 0 Compile time error None of these 2.0 ANSWER DOWNLOAD EXAMIANS APP