JAVA Constructors and Methods What will be the return type of a method that not returns any value? None of these double void int None of these double void int ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What will be the result of compiling and running the given code?class A{ int b=10; private A(){ this.b=7; } int f(){ return b; }}class B extends A{ int b;}public class Test{ public static void main(String[] args){ A a = new B(); System.out.println(a.f()); }} Prints 0 Compilation Fails Prints 7 None of these Prints 10 Prints 0 Compilation Fails Prints 7 None of these Prints 10 ANSWER DOWNLOAD EXAMIANS APP
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 ) ; } } 2.0 0 None of these Compile time error 2.0 0 None of these Compile time error 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 4 At line 1, constructor Tester must be marked public like its class At line 2, constructor call At line 3, compilation error, ambiguity problem, compiler can't determine whether a constructor At line 4 At line 1, constructor Tester must be marked public like its class At line 2, constructor call At line 3, compilation error, ambiguity problem, compiler can't determine whether a constructor ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? Test( ) Test(void) public Test( ) public Test(void) None of these Test( ) Test(void) public Test( ) public Test(void) None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Which of the modifier can't be used for constructors? protected public static private protected public static private ANSWER DOWNLOAD EXAMIANS APP