Logo

Java Questions Set 157:

Quiz Mode

Which keyword is used to define enumerated types in Java?

1
2
3
4

Solution:

What is JUnit primarily used for?

1
2
3
4

Solution:

What is the value of the following expression?

-4 + 1/2 + 2*-3 + 5.0

1
2
3
4

Solution:

Runtime polymorphism feature in java is

1
2
3
4

Solution:

 Any already defined method in java library can be defined again in the program with the different data type of parameters 

1
2

Solution:

How can an object become serializable in Java?

1
2
3
4

Solution:

Predict the output of the following Java code.

class Abekus {

public static void main(String[] args)

{

do

while (true);

System.out.printf("Amrit");

}

}

1
2
3
4

Solution:

Deduce the output of the following code:


public class MyClass {

public static void main(String args[]) {

int x=10;

if(x==10)


    System.out.println("10");


else if (x==10)


    System.out.println("20");


else


    System.out.println("30");}

}

Solution:

 public class output

    {

        public static void main(String args[])

        {

            Double i = new Double(400.56);  

            int a = i.intValue();

            System.out.print(a);

        }

    }

1
2
3
4

Solution:

Predict the output of the following Java code:

import java.util.*;

import java.util.concurrent.LinkedBlockingQueue;

public class Abekus {

public static void main(String[] args)

throws IllegalStateException {

Queue<String> que = new LinkedBlockingQueue<String>(4);

que.offer("h");

que.offer("n");

try {

que.offer(null);

} catch (Exception e) {

System.out.println(e);

}

}

}

1
2
3
4

Solution: