JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? None of these public Test( ) public Test(void) Test( ) Test(void) None of these public Test( ) public Test(void) Test( ) Test(void) 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 2 Compilation fails due to an error on line 1 One Compilation succeed but no output. Compilation fails due to an error on line 2 Compilation fails due to an error on line 1 One Compilation succeed but no output. 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(){} MyClass(void) {} public MyClass(){} public MyClass(void){} 1 and 3 MyClass(){} MyClass(void) {} public MyClass(){} public MyClass(void){} 1 and 3 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Determine output:public class Test{ public static void main(String args[]){ MyClass obj = new MyClass(); obj.val = 1; obj.call(obj); System.out.println(obj.val); }}class MyClass{ public int val; public void call(MyClass ref){ ref.val++; }} None of these 1 3 2 Compilation Error None of these 1 3 2 Compilation Error 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.5 10.0 1.0 0.0 0.5 10.0 1.0 0.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 8 Compile fail due to error on line no 2 15 None of these Compile fail due to error on line no 9 Compile fail due to error on line no 8 Compile fail due to error on line no 2 15 None of these Compile fail due to error on line no 9 ANSWER DOWNLOAD EXAMIANS APP