JAVA Constructors and Methods Which of the modifier can't be used for constructors? private static public protected private static public protected 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(5); All of these A a = new B(); None of these A a = new A(String s); A a = new B(5); All of these A a = new B(); None of these A a = new A(String s); 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 None of these 0 Compile time error 2.0 None of these 0 Compile time error ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The main method should be static for the reason It can be accessed easily by the class loader. It can be accessed by every method or variable without any hindrance. It can be executed without creating any instance of the class. None of these It can be accessed easily by the class loader. It can be accessed by every method or variable without any hindrance. It can be executed without creating any instance of the class. None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods In which area of memory, the system stores parameters and local variables whenever a method is invoked? Storage Area Stack Heap Array Storage Area Stack Heap Array 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 Compilation succeed but no output. One Compilation fails due to an error on line 2 Compilation fails due to an error on line 1 Compilation succeed but no output. One ANSWER DOWNLOAD EXAMIANS APP