JAVA Constructors and Methods What is the output of the above program ?class Num { Num(double x ){ System.out.println( x ) ; } }public class Test extends Num { public static void main(String[] args){ Num num = new Num( 2 ) ; } } Compile time error 0 2.0 None of these Compile time error 0 2.0 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}} One Compilation succeed but no output. Compilation fails due to an error on line 1 Compilation fails due to an error on line 2 One Compilation succeed but no output. Compilation fails due to an error on line 1 Compilation fails due to an error on line 2 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The implicit return type of a constructor is None of these There is no return type. A class object in which it is defined. void None of these There is no return type. A class object in which it is defined. void ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? Test(void) public Test( ) Test( ) public Test(void) None of these Test(void) public Test( ) Test( ) public Test(void) None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The following code contains one compilation error, find it?public class Test {Test() { } // line 1static void Test() { this(); } // line 2 public static void main(String[] args) { // line 3Test(); // line 4}} At line 3, compilation error, ambiguity problem, compiler can't determine whether a constructor At line 2, constructor call At line 1, constructor Tester must be marked public like its class At line 4 At line 3, compilation error, ambiguity problem, compiler can't determine whether a constructor At line 2, constructor call At line 1, constructor Tester must be marked public like its class At line 4 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 B(); A a = new B(5); None of these All of these A a = new A(String s); A a = new B(); A a = new B(5); None of these All of these A a = new A(String s); ANSWER DOWNLOAD EXAMIANS APP