JAVA Constructors and Methods public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor? public MyClass(){} MyClass(){} MyClass(void) {} public MyClass(void){} 1 and 3 public MyClass(){} MyClass(){} MyClass(void) {} public MyClass(void){} 1 and 3 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? Heap Stack Storage Area Array Heap Stack Storage Area Array 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(); }} None of these one one two Compilation Error one Exception two one one None of these one one two Compilation Error one Exception two one one 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 Compile time error as final method can't be overloaded Method 1 Method 2 None of these Compile time error as final method can't be overloaded Method 1 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? Test(void) None of these public Test( ) Test( ) public Test(void) Test(void) None of these public Test( ) Test( ) public Test(void) ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Which of the following options is the best for generating random integer 0 or 1? (int)(Math.random() + 0.2) (int)Math.random() + 1 (int)Math.random() (int)(Math.random() + 0.5) (int)(Math.random() + 0.2) (int)Math.random() + 1 (int)Math.random() (int)(Math.random() + 0.5) ANSWER DOWNLOAD EXAMIANS APP