JAVA Constructors and Methods Which of the modifier can't be used for constructors? static private public protected static private public protected 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() (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) (int)(Math.random() + 0.2) 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); }} Compilation clean but throws RuntimeException long None of these int Compilation fails Compilation clean but throws RuntimeException long None of these int Compilation fails ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The implicit return type of a constructor is A class object in which it is defined. There is no return type. None of these void A class object in which it is defined. There is no return type. None of these void ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The finalize() method is called just prior to An object, variable or method goes out of scope. None of these Before garbage collection. An object or variable goes out of scope. A variable goes out of scope. An object, variable or method goes out of scope. None of these Before garbage collection. An object or variable goes out of scope. A variable goes out of scope. 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 0 0 5 8 0 8 5 0 0 0 5 8 0 8 ANSWER DOWNLOAD EXAMIANS APP