JAVA Constructors and Methods Which of the following options is the best for generating random integer 0 or 1? (int)Math.random() (int)(Math.random() + 0.2) (int)(Math.random() + 0.5) (int)Math.random() + 1 (int)Math.random() (int)(Math.random() + 0.2) (int)(Math.random() + 0.5) (int)Math.random() + 1 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Which of the modifier can't be used for constructors? protected public static private protected public static private ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What will be the result of compiling and running the given code?class A{ int b=10; private A(){ this.b=7; } int f(){ return b; }}class B extends A{ int b;}public class Test{ public static void main(String[] args){ A a = new B(); System.out.println(a.f()); }} Prints 0 Prints 7 Prints 10 Compilation Fails None of these Prints 0 Prints 7 Prints 10 Compilation Fails None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The main method should be static for the reason None of these It can be executed without creating any instance of the class. It can be accessed easily by the class loader. It can be accessed by every method or variable without any hindrance. None of these It can be executed without creating any instance of the class. It can be accessed easily by the class loader. It can be accessed by every method or variable without any hindrance. 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 0 5 8 0 8 0 0 5 0 5 8 0 8 0 0 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