JAVA Constructors and Methods What will be the return type of a method that not returns any value? void None of these double int void None of these double int 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.} 15 None of these Compile fail due to error on line no 8 Compile fail due to error on line no 9 Compile fail due to error on line no 2 15 None of these Compile fail due to error on line no 8 Compile fail due to error on line no 9 Compile fail due to error on line no 2 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the output of the program?class Test{ public int display(int x, int y){ return ("The sum of x and y is " + x + y); } public static void main(String args[]){ Test test = new Test(); System.out.println(test.display(4,5)); } } The sum of x and y is 45 does not compile The sum of x and y is 9 None of these The sum of x and y is 45 does not compile The sum of x and y is 9 None of these 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 5 8 0 8 5 0 0 0 5 8 0 8 5 0 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( ) ) ) ; }} 0.0 1.0 0.5 10.0 0.0 1.0 0.5 10.0 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? None of these public Test( ) Test(void) public Test(void) Test( ) None of these public Test( ) Test(void) public Test(void) Test( ) ANSWER DOWNLOAD EXAMIANS APP