JAVA Constructors and Methods What will be the return type of a method that not returns any value? int double None of these void int double None of these void ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Determine output of the following program.public class Test{ public static void main(String args[]){ System.out.println( Math.floor( Math.random( ) ) ) ; }} 0.5 10.0 0.0 1.0 0.5 10.0 0.0 1.0 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 7 Prints 10 None of these Prints 0 Compilation Fails Prints 7 Prints 10 None of these Prints 0 Compilation Fails 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() + 0.5) (int)Math.random() + 1 (int)(Math.random() + 0.2) (int)Math.random() (int)(Math.random() + 0.5) (int)Math.random() + 1 (int)(Math.random() + 0.2) ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The variables declared in a class for the use of all methods of the class are called instance variables objects reference variables None of these instance variables objects reference variables None of these 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); }} 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 static 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 static ANSWER DOWNLOAD EXAMIANS APP