JAVA Constructors and Methods Which of the following options is the best for generating random integer 0 or 1? (int)(Math.random() + 0.5) (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() ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The finalize() method is called just prior to Before garbage collection. A variable goes out of scope. An object, variable or method goes out of scope. None of these An object or variable goes out of scope. Before garbage collection. A variable goes out of scope. An object, variable or method goes out of scope. None of these An object or variable goes out of scope. ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What will be the return type of a method that not returns any value? None of these int void double None of these int void double ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the output of the above program ?class Num { Num(double x ){ System.out.println( x ) ; } }public class Test extends Num { public static void main(String[] args){ Num num = new Num( 2 ) ; } } None of these 2.0 0 Compile time error None of these 2.0 0 Compile time error ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The main method should be static for the reason It can be accessed easily by the class loader. None of these It can be accessed by every method or variable without any hindrance. It can be executed without creating any instance of the class. It can be accessed easily by the class loader. None of these It can be accessed by every method or variable without any hindrance. It can be executed without creating any instance of the class. ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Which of these is a legal definition of a method named examveda assuming it throws IOException, and returns void. Also assume that the method does not take any arguments. Select the one correct answer. void examians(void) throws IOException{} void examians() throws IOException{} examians() throws IOException{} void examians() throw IOException{} void examians() {} throws IOException void examians(void) throws IOException{} void examians() throws IOException{} examians() throws IOException{} void examians() throw IOException{} void examians() {} throws IOException ANSWER DOWNLOAD EXAMIANS APP