The finalize() method is called just prior to None of these An object, variable or method goes out of scope. An object or variable goes out of scope. A variable goes out of scope. Before garbage collection. 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();}} Animal Wild Wild Animal Runtime Exception Compilation Error TRUE ANSWER : ? YOUR ANSWER : ?
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 TRUE ANSWER : ? YOUR ANSWER : ?
public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor? MyClass(){} public MyClass(){} 1 and 3 MyClass(void) {} public MyClass(void){} TRUE ANSWER : ? YOUR ANSWER : ?
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() TRUE ANSWER : ? YOUR ANSWER : ?
What will be the return type of a method that not returns any value? double None of these void int 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 2 Method 1 None of these Compile time error as final method can't be overloaded TRUE ANSWER : ? YOUR ANSWER : ?
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); }} Won't compile because of line (5), constructor can't be static Won't compile because of line (1), constructor can't be private 10 50 50 TRUE ANSWER : ? YOUR ANSWER : ?
Determine output:public class Test{ public static void main(String args[]){ MyClass obj = new MyClass(); obj.val = 1; obj.call(obj); System.out.println(obj.val); }}class MyClass{ public int val; public void call(MyClass ref){ ref.val++; }} Compilation Error 2 None of these 1 3 TRUE ANSWER : ? YOUR ANSWER : ?