JAVA Constructors and Methods What is Math.floor(3.6)? 4.0 3 4 3.0 4.0 3 4 3.0 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(void){} MyClass(void) {} MyClass(){} public MyClass(){} 1 and 3 public MyClass(void){} MyClass(void) {} MyClass(){} public MyClass(){} 1 and 3 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods class A{ A(String s){} A(){}}1. class B extends A{2. B(){}3. B(String s){4. super(s);5. }6. void test(){7. // insert code here8. }9. }Which of the below code can be insert at line 7 to make clean compilation ? All of these A a = new B(5); None of these A a = new B(); A a = new A(String s); All of these A a = new B(5); None of these A a = new B(); A a = new A(String s); ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The finalize() method is called just prior to None of these An object or variable goes out of scope. A variable goes out of scope. Before garbage collection. An object, variable or method goes out of scope. None of these An object or variable goes out of scope. A variable goes out of scope. Before garbage collection. An object, variable or method goes out of scope. ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods class MyClass{int i;int j;public MyClass(int i, int j){this.i = i;this.j = j;}public void call(){System.out.print("One");}}public class Test{public static void main(String args[]){MyClass m = new MyClass(); //line 1m.call(); //line 2}} One Compilation fails due to an error on line 1 Compilation succeed but no output. Compilation fails due to an error on line 2 One Compilation fails due to an error on line 1 Compilation succeed but no output. Compilation fails due to an error on line 2 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++; }} 1 2 None of these 3 Compilation Error 1 2 None of these 3 Compilation Error ANSWER DOWNLOAD EXAMIANS APP