JAVA Constructors and Methods In which area of memory, the system stores parameters and local variables whenever a method is invoked? Heap Array Stack Storage Area Heap Array Stack Storage Area 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() (int)Math.random() + 1 (int)(Math.random() + 0.5) (int)(Math.random() + 0.2) (int)Math.random() (int)Math.random() + 1 (int)(Math.random() + 0.5) ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor? MyClass(void) {} public MyClass(){} 1 and 3 MyClass(){} public MyClass(void){} MyClass(void) {} public MyClass(){} 1 and 3 MyClass(){} public MyClass(void){} ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The implicit return type of a constructor is A class object in which it is defined. None of these void There is no return type. A class object in which it is defined. None of these void There is no return type. ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the expected output?public class Profile {private Profile(int w) { // line 1System.out.print(w);}public final Profile() { // line 5System.out.print(10);}public static void main(String args[]) {Profile obj = new Profile(50);}} Won't compile because of line (5); constructor can't be final 10 50 50 Won't compile because of line (1); constructor can't be private Won't compile because of line (5); constructor can't be final 10 50 50 Won't compile because of line (1); constructor can't be private ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the expected output?public class Profile { private Profile(int w) { // line 1 System.out.print(w); } public static Profile() { // line 5 System.out.print (10); } public static void main(String args[]) { Profile obj = new Profile(50); }} 50 Won't compile because of line (5), constructor can't be static Won't compile because of line (1), constructor can't be private 10 50 50 Won't compile because of line (5), constructor can't be static Won't compile because of line (1), constructor can't be private 10 50 ANSWER DOWNLOAD EXAMIANS APP