JAVA Constructors and Methods public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor? MyClass(){} public MyClass(){} MyClass(void) {} 1 and 3 public MyClass(void){} MyClass(){} public MyClass(){} MyClass(void) {} 1 and 3 public MyClass(void){} ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is Math.floor(3.6)? 3.0 3 4 4.0 3.0 3 4 4.0 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the output for the below code?public class Test{ public static void printValue(int i, int j, int k){ System.out.println("int"); } public static void printValue(byte...b){ System.out.println("long"); } public static void main(String... args){ byte b = 9; printValue(b,b,b); }} long Compilation fails int Compilation clean but throws RuntimeException None of these long Compilation fails int Compilation clean but throws RuntimeException None of these 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}} Compilation fails due to an error on line 1 Compilation fails due to an error on line 2 Compilation succeed but no output. One Compilation fails due to an error on line 1 Compilation fails due to an error on line 2 Compilation succeed but no output. One 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 What is the expected output?public class Profile {private Profile(int w) { // line 1System.out.print(w);}public final Profile() { // line 5System.out.print(10);}public static void main(String args[]) {Profile obj = new Profile(50);}} Won't compile because of line (5); constructor can't be final 50 Won't compile because of line (1); constructor can't be private 10 50 Won't compile because of line (5); constructor can't be final 50 Won't compile because of line (1); constructor can't be private 10 50 ANSWER DOWNLOAD EXAMIANS APP