JAVA Constructors and Methods What is Math.floor(3.6)? 4 3 3.0 4.0 4 3 3.0 4.0 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the output for the below code ?1. public class A{2. int add(int i, int j){3. return i+j;4. }5. }6. public class B extends A{7. public static void main(String argv[]){8. short s = 9;9. System.out.println(add(s,6));10. }11.} Compile fail due to error on line no 9 None of these 15 Compile fail due to error on line no 2 Compile fail due to error on line no 8 Compile fail due to error on line no 9 None of these 15 Compile fail due to error on line no 2 Compile fail due to error on line no 8 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 Prints 7 Compilation Fails Prints 10 None of these Prints 0 Prints 7 Compilation Fails Prints 10 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); }} B 8 A 5 A B 8 A 5 B 8 A B 5 None of these B 8 A 5 A B 8 A 5 B 8 A B 5 None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The variables declared in a class for the use of all methods of the class are called objects instance variables None of these reference variables objects instance variables None of these reference variables ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Given the following piece of code:class Person{ public int number;}public class Test{ public void doIt(int i , Person p){ i = 5; p.number = 8; } public static void main(String args[]){ int x = 0; Person p = new Person(); new Test().doIt(x, p); System.out.println(x + " " + p.number); }}What is the result? 0 8 5 8 5 0 0 0 0 8 5 8 5 0 0 0 ANSWER DOWNLOAD EXAMIANS APP