JAVA Constructors and Methods What is Math.floor(3.6)? 4 4.0 3 3.0 4 4.0 3 3.0 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 ? A a = new A(String s); A a = new B(); None of these A a = new B(5); All of these A a = new A(String s); A a = new B(); None of these A a = new B(5); All of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods class MyClass{ MyClass(){ System.out.print("one"); } public void myMethod(){ this(); System.out.print("two"); }} public class TestClass{ public static void main(String args[]){ MyClass obj = new MyClass(); obj.myMethod(); }} Compilation Error one one two one Exception None of these two one one Compilation Error one one two one Exception None of these two one one ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor? MyClass(){} 1 and 3 public MyClass(){} public MyClass(void){} MyClass(void) {} MyClass(){} 1 and 3 public MyClass(){} public MyClass(void){} MyClass(void) {} 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();}} Compilation Error Wild Animal Runtime Exception Animal Wild Compilation Error Wild Animal Runtime Exception Animal Wild 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 8 A 5 B 8 A B 5 B 8 A 5 None of these A B 8 A 5 B 8 A B 5 ANSWER DOWNLOAD EXAMIANS APP