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(void){} public MyClass(){} MyClass(void) {} MyClass(){} 1 and 3 public MyClass(void){} public MyClass(){} MyClass(void) {} 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); }} A 5 B 8 None of these A B 5 B 8 A 5 A B 8 A 5 B 8 None of these A B 5 B 8 A 5 A B 8 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is Math.floor(3.6)? 4 3.0 4.0 3 4 3.0 4.0 3 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? Test( ) Test(void) public Test(void) None of these public Test( ) Test( ) Test(void) public Test(void) None of these public Test( ) 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( ) ) ) ; }} 10.0 1.0 0.5 0.0 10.0 1.0 0.5 0.0 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 0 0 8 5 8 5 0 0 0 0 8 5 8 5 0 ANSWER DOWNLOAD EXAMIANS APP