The main method should be static for the reason None of these It can be executed without creating any instance of the class. It can be accessed by every method or variable without any hindrance. It can be accessed easily by the class loader. 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.0 1.0 0.5 10.0 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++; }} 2 Compilation Error None of these 3 1 TRUE ANSWER : ? YOUR ANSWER : ?
The variables declared in a class for the use of all methods of the class are called None of these instance variables objects reference variables TRUE ANSWER : ? YOUR ANSWER : ?
What is the output for the below code?public class Test{ public static void printValue(int i, int j, int k){ System.out.println("int"); } public static void printValue(byte...b){ System.out.println("long"); } public static void main(String... args){ byte b = 9; printValue(b,b,b); }} None of these Compilation fails int long Compilation clean but throws RuntimeException TRUE ANSWER : ? YOUR ANSWER : ?
What will be the return type of a method that not returns any value? None of these double void int TRUE ANSWER : ? YOUR ANSWER : ?
What is the expected output?public class Profile {private Profile(int w) { // line 1System.out.print(w);}public final Profile() { // line 5System.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 final 10 50 Won't compile because of line (1); constructor can't be private 50 TRUE ANSWER : ? YOUR ANSWER : ?
In which area of memory, the system stores parameters and local variables whenever a method is invoked? Storage Area Stack Heap Array TRUE ANSWER : ? YOUR ANSWER : ?
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 ? None of these A a = new B(5); All of these A a = new A(String s); A a = new B(); TRUE ANSWER : ? YOUR ANSWER : ?
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. examians() throws IOException{} void examians() throw IOException{} void examians(void) throws IOException{} void examians() {} throws IOException void examians() throws IOException{} TRUE ANSWER : ? YOUR ANSWER : ?