JAVA Constructors and Methods public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor? MyClass(void) {} 1 and 3 public MyClass(){} public MyClass(void){} MyClass(){} MyClass(void) {} 1 and 3 public MyClass(){} public MyClass(void){} MyClass(){} 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 B 8 B 8 A 5 None of these A 5 B 8 A B 5 A B 8 B 8 A 5 None of these A 5 B 8 A B 5 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? public Test( ) public Test(void) Test(void) None of these Test( ) public Test( ) public Test(void) Test(void) None of these Test( ) ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Given the following piece of code:class Person{ public int number;}public class Test{ public void doIt(int i , Person p){ i = 5; p.number = 8; } public static void main(String args[]){ int x = 0; Person p = new Person(); new Test().doIt(x, p); System.out.println(x + " " + p.number); }}What is the result? 5 8 5 0 0 0 0 8 5 8 5 0 0 0 0 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? Storage Area Heap Array Stack Storage Area Heap Array Stack ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Which of the modifier can't be used for constructors? private protected public static private protected public static ANSWER DOWNLOAD EXAMIANS APP