Logo

Java Questions Set 179:

Quiz Mode

Which of the following is not a wrapper class?

1
2
3
4

Solution:

Which of the keywords is not related to Exception handling?

1
2
3
4

Solution:

Which of the following is an incorrect JUnit annotation?

1
2
3
4

Solution:

Predict the output of the following Java code.

1
2
3

Solution:

The purpose of the for loop is:

1
2
3
4

Solution:

Which operator is used by Java runtime implementations to automatically free the memory of an object when it is no longer needed?

1
2
3
4

Solution:

Statement 1-  Extension of java code files is  .java 

Statement 2-   Extension of compiled java classes is .class

1
2
3
4

Solution:

What does the following Java code print?


public class Test {

public static void main(String[] args) {

System.out.print("Hello");

System.out.println("World");

}

}

1
2
3
4

Solution:

class test {

public static void main (String[] args) {

        char a='A';

                 char b=70;

                 a++;

                 a+=10*4;

                 System.out.println((int)a);

}

}

1
2
3
4

Solution:

Predict the output of the following Java code:

class Abekus {

int _a, _b;

public Abekus(int x, int y) { _a = x; _b = y; }

public Abekus() { this(10, 10); }

public int a() { return _a; }

public int b() { return _b; }

public static void main(String args[]) {

Abekus A = new Abekus();

System.out.println(A.a());

}

}

1
2
3
4

Solution: