JAVA Constructors and Methods public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor? MyClass(void) {} public MyClass(){} public MyClass(void){} MyClass(){} 1 and 3 MyClass(void) {} public MyClass(){} public MyClass(void){} MyClass(){} 1 and 3 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Determine output of the following program.public class Test{ public static void main(String args[]){ System.out.println( Math.floor( Math.random( ) ) ) ; }} 1.0 0.5 10.0 0.0 1.0 0.5 10.0 0.0 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The finalize() method is called just prior to A variable goes out of scope. An object or variable goes out of scope. Before garbage collection. An object, variable or method goes out of scope. None of these A variable goes out of scope. An object or variable goes out of scope. Before garbage collection. An object, variable or method goes out of scope. 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 Compilation Fails Prints 7 None of these Prints 10 Prints 0 Compilation Fails Prints 7 None of these Prints 10 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What will be the return type of a method that not returns any value? double void int None of these double void int 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 Animal Wild Compilation Error Runtime Exception Wild Animal Animal Wild Compilation Error ANSWER DOWNLOAD EXAMIANS APP