Logo

Java Questions Set 214:

Quiz Mode

All java classes are derived from

1
2
3
4

Solution:

What is the superclass of all errors and exceptions in Java?

1
2
3
4

Solution:

What does an interface contain?

1
2
3
4

Solution:

Which of the following methods in the Byte wrapper class returns the value as a double?

1
2
3
4

Solution:

Which of these method of Thread class is used to find out the priority given to a thread?

1
2
3
4

Solution:

How many times 'abekus' is printed?

public class abekus

{

public static void main(String[] args) {

   

  for(int i = 0; i<5; i++);

  {

 System.out.println("abekus");

  }

}

}

1
2
3
4

Solution:

//Predict the output

import java.util.Scanner;

public class Main

{

    public static void main(String args[])

    {

        String s1 = "Hi fi"; 

        boolean s2 = s1.startsWith("Hifi"); 

        System.out.println(s2); 

    }

}

1
2
3
4

Solution:

What is the output of the following Java code?

import java.util.*;

import java.util.stream.IntStream;

class Abekus {

public static void main(String[] args) {

IntStream i = IntStream.empty();

boolean j = i.allMatch(n -> true);

System.out.println(j);

}

}

1
2
3

Solution:

Predict the output of the following Java code:

import java.util.Scanner;

public class Main

{

    public static void main(String args[])

    {

        String s1= "I am internet"; 

        String s2 = new String(s1); 

        System.out.println(s1.equals(s2)); 

    }

}

1
2
3
4

Solution:

Predict the output of the following Java code.

class Abekus {

public static void main(String args[]) {

try {

int i = 78 / 25;

System.out.println(i);

}

catch(Exception e) {

System.out.println("Exception Caught");

}

finally

{

System.out.println("finally");

}

}

}

1
2
3
4

Solution: