Logo

Java Questions Set 83:

Quiz Mode

Which of the following is not an operator?

1
2
3
4

Solution:

Hibernate is a _________?

1
2
3
4

Solution:

Predict the output of the following Java code.

1
2
3
4

Solution:

Which of these methods of the ObjectInput interface is used to deserialize an object from a stream?

1
2
3
4

Solution:

What is the default access modifier for variables declared in an interface?

1
2
3
4

Solution:

class jj

{

public static void main(String args[])

StringBuffer sb = new StringBuffer("Abekus");

sb.insert(0,"Hello");

System.out.println(sb);

   }

}

1
2
3
4

Solution:

class test{

public static void main (String[] args) {

   int a=10,b=20;

   for(int i=0;a>b;i++)

   {

       System.out.println("Hello");

   }

   System.out.println("World");

}

}

1
2
3
4

Solution:

What will be the output of the following Java program?


class String_demo

{

public static void main(String args[])

{

char chars[] = {'a', 'b', 'c'};

String s = new String(chars);

String s1 = "abcd";

int len1 = s1.length();

int len2 = s.length();

System.out.println(len1 + " " + len2);

}

}

1
2
3
4

Solution:

Output of following Java program?


class Test {
   public static void main (String[] args) {
       

        int arr1[] = {1, 2, 3};
       int arr2[] = {1, 2, 3};
 

        if (arr1 == arr2)
           System.out.println("Equal");
       else
           System.out.println("Not Equal");

    }

}

1
2

Solution:

Predict the output of the following Java code.

class Abekus {

public void flip(String str) {

String[] arr = str.split(";");

for (String s : arr) {

System.out.println(s.trim()); }

}

public static void main(String[] args) {

char arr1[] = {'1', '2', ' ', '3', '4', ';', '5', '6', ' ', '7', '8', ';', '9', '0', ' ', '#', '@'};

String s1 = new String(arr1);

Abekus o = new Abekus();

o.flip(s1); }

}

1
2
3
4

Solution: