JAVA Constructors and Methods public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor? 1 and 3 public MyClass(){} MyClass(void) {} MyClass(){} public MyClass(void){} 1 and 3 public MyClass(){} MyClass(void) {} MyClass(){} public MyClass(void){} ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Determine Output:class A{public static void method(int i){System.out.print("Method 1");}public static int method(String str){System.out.print("Method 2");return 0;}}public class Test{ public static void main(String args[]){A.method(5);}} Method 2 None of these Method 1 Compile time error as final method can't be overloaded Method 2 None of these Method 1 Compile time error as final method can't be overloaded ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the output for the below code ?class A{ public A(){ System.out.println("A"); } public A(int i){ this(); System.out.println(i); }}class B extends A{ public B(){ System.out.println("B"); } public B(int i){ this(); System.out.println(i+3); }}public class Test{ public static void main (String[] args){ new B(5); }} A 5 B 8 B 8 A 5 A B 5 None of these A B 8 A 5 B 8 B 8 A 5 A B 5 None of these A B 8 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? Array Storage Area Heap Stack Array Storage Area Heap Stack ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? Test(void) public Test(void) None of these public Test( ) Test( ) Test(void) public Test(void) None of these public Test( ) Test( ) 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 ) ; } } None of these 0 2.0 Compile time error None of these 0 2.0 Compile time error ANSWER DOWNLOAD EXAMIANS APP