JAVA Constructors and Methods public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor? public MyClass(void){} 1 and 3 MyClass(){} MyClass(void) {} public MyClass(){} public MyClass(void){} 1 and 3 MyClass(){} MyClass(void) {} public MyClass(){} ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Determine output:public class Test{ public static void main(String args[]){ MyClass obj = new MyClass(); obj.val = 1; obj.call(obj); System.out.println(obj.val); }}class MyClass{ public int val; public void call(MyClass ref){ ref.val++; }} None of these 3 Compilation Error 2 1 None of these 3 Compilation Error 2 1 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? Test(void) public Test(void) public Test( ) None of these Test( ) Test(void) public Test(void) public Test( ) None of these Test( ) 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 Heap Stack Storage Area Array Heap Stack Storage Area ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the output for the below code?public class Test{ public static void printValue(int i, int j, int k){ System.out.println("int"); } public static void printValue(byte...b){ System.out.println("long"); } public static void main(String... args){ byte b = 9; printValue(b,b,b); }} None of these long Compilation fails int Compilation clean but throws RuntimeException None of these long Compilation fails int Compilation clean but throws RuntimeException ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods class MyClass{ MyClass(){ System.out.print("one"); } public void myMethod(){ this(); System.out.print("two"); }} public class TestClass{ public static void main(String args[]){ MyClass obj = new MyClass(); obj.myMethod(); }} Compilation Error two one one None of these one one two one Exception Compilation Error two one one None of these one one two one Exception ANSWER DOWNLOAD EXAMIANS APP