public class Test { }What is the prototype of the default constructor? None of these public Test(void) Test(void) Test( ) public Test( ) TRUE ANSWER : ? YOUR ANSWER : ?
The main method should be static for the reason 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. TRUE ANSWER : ? YOUR ANSWER : ?
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() + 1 (int)(Math.random() + 0.5) TRUE ANSWER : ? YOUR ANSWER : ?
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();}} Wild Animal Compilation Error Runtime Exception Animal Wild TRUE ANSWER : ? YOUR ANSWER : ?
Determine Output:class A{public static void method(int i){System.out.print("Method 1");}public static int method(String str){System.out.print("Method 2");return 0;}}public class Test{ public static void main(String args[]){A.method(5);}} Method 1 None of these Method 2 Compile time error as final method can't be overloaded TRUE ANSWER : ? YOUR ANSWER : ?
Determine output of the following program.public class Test{ public static void main(String args[]){ System.out.println( Math.floor( Math.random( ) ) ) ; }} 0.5 0.0 10.0 1.0 TRUE ANSWER : ? YOUR ANSWER : ?
In which area of memory, the system stores parameters and local variables whenever a method is invoked? Heap Storage Area Stack Array TRUE ANSWER : ? YOUR ANSWER : ?
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? 0 8 5 8 0 0 5 0 TRUE ANSWER : ? YOUR ANSWER : ?
What is the output for the below code ?class A{ public A(){ System.out.println("A"); } public A(int i){ this(); System.out.println(i); }}class B extends A{ public B(){ System.out.println("B"); } public B(int i){ this(); System.out.println(i+3); }}public class Test{ public static void main (String[] args){ new B(5); }} A 5 B 8 A B 5 B 8 A 5 A B 8 None of these TRUE ANSWER : ? YOUR ANSWER : ?
What will be the return type of a method that not returns any value? None of these void int double TRUE ANSWER : ? YOUR ANSWER : ?