Logo

Java Questions Set 26:

Quiz Mode

Can we declare an interface as final?

1
2

Solution:

 Which of these is an incorrect array declaration? 

1
2

Solution:

Which of these selection statements test only for equality?

1
2
3
4

Solution:

Java does not support

1
2
3
4

Solution:

What does setAutoCommit(false) do?

1
2
3
4

Solution:

Which Java interface provides the capability to store elements in a collection that guarantees no duplicates and maintains the elements in natural order?

1
2
3
4

Solution:

class test {

public static void main (String[] args) {

  boolean a=true;

  boolean b=!a;

  boolean c=b|!a;

  boolean d=a&&!b;

  boolean e=!d?b:c;

  System.out.println(d+" "+c);

}

}

1
2
3
4

Solution:

What will be the output of the following Java code?


class Output

{

public static void main(String[] args)

{

String s1 = "Hello I love Java";

String s2 = new String(s1);

System.out.println((s1 == s2) + " " + s1.equals(s2));

}

}

1
2
3
4

Solution:

what should be the output of this code block?

  public class abekus {

    public static void main(String[] args) {

      String input = " abekus ";

      input = input.trim();

      System.out.print(input.length());

      input = input + " ";

      input = input + " ";

      System.out.print(input.length());

    }

  }

Solution:

Predict the output of the following Java code:

public class Child extends Parent

{

public static String song()

{

return "sa re";

}

public static void main(String[] args)

{

Child a = new Child();

Parent b = new Child();

System.out.println(a.song() + " " + b.song());

}

}

class Parent

{

public static String song()

{

return "ga ma";

}

}

1
2
3
4
5

Solution: