In which area of memory, the system stores parameters and local variables whenever a method is invoked? Array Storage Area Stack Heap TRUE ANSWER : ? YOUR ANSWER : ?
What will be the return type of a method that not returns any value? void int None of these double TRUE ANSWER : ? YOUR ANSWER : ?
public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor? public MyClass(void){} MyClass(void) {} 1 and 3 MyClass(){} public MyClass(){} TRUE ANSWER : ? YOUR ANSWER : ?
What is the output of the above program ?class Num { Num(double x ){ System.out.println( x ) ; } }public class Test extends Num { public static void main(String[] args){ Num num = new Num( 2 ) ; } } None of these 0 Compile time error 2.0 TRUE ANSWER : ? YOUR ANSWER : ?
The implicit return type of a constructor is None of these There is no return type. void A class object in which it is defined. 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); }} Compilation fails long Compilation clean but throws RuntimeException None of these int 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 10 50 50 Won't compile because of line (1), constructor can't be private 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? 5 0 0 8 0 0 5 8 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); }} B 8 A 5 None of these A 5 B 8 A B 8 A B 5 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() throws IOException{} void examians() throw IOException{} void examians(void) throws IOException{} void examians() {} throws IOException TRUE ANSWER : ? YOUR ANSWER : ?