JAVA Constructors and Methods Which of the following options is the best for generating random integer 0 or 1? (int)Math.random() + 1 (int)(Math.random() + 0.5) (int)Math.random() (int)(Math.random() + 0.2) (int)Math.random() + 1 (int)(Math.random() + 0.5) (int)Math.random() (int)(Math.random() + 0.2) 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 8 0 8 5 0 0 0 5 8 0 8 5 0 0 0 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the expected output?class Animal {Animal() {System.out.println("Animal");}}class Wild extends Animal{Wild() {System.out.println("Wild");super();}}public class Test {public static void main(String args[]) {Wild wild = new Wild();}} Animal Wild Runtime Exception Wild Animal Compilation Error Animal Wild Runtime Exception Wild Animal Compilation Error 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 Array Stack Storage Area Heap Array Stack Storage Area ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods class A{ A(String s){} A(){}}1. class B extends A{2. B(){}3. B(String s){4. super(s);5. }6. void test(){7. // insert code here8. }9. }Which of the below code can be insert at line 7 to make clean compilation ? A a = new B(); All of these None of these A a = new B(5); A a = new A(String s); A a = new B(); All of these None of these A a = new B(5); A a = new A(String s); 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() throw IOException{} void examians() throws IOException{} examians() throws IOException{} void examians() {} throws IOException void examians(void) throws IOException{} void examians() throw IOException{} void examians() throws IOException{} examians() throws IOException{} void examians() {} throws IOException ANSWER DOWNLOAD EXAMIANS APP