Logo

Java Questions Set 135:

Quiz Mode

 OutOfMemoryError  exception is thrown when java is out of memory 

1
2

Solution:

Which of these keywords are used to define an abstract class?

1
2
3
4

Solution:

Statement 1 - String class has 13 constructors.

 Statement  2 - String class has 60 methods.

1
2
3
4

Solution:

What is the output of the following Java code?

class Test {

public static void main(String[] args) {

int x = 8;

System.out.println(++x * 3 + " " + x);

}

}

1
2
3
4

Solution:

public class Demo123{

     public static void main(String args[]){

  int i =4;

  if(i==4);

  System.out.println("Abekus");

     

}

}

1
2
3
4

Solution:

Operands of Arithmetic operations

Statement 1-Character

Statement 2-Numeric 

Statement 3-Boolean

1
2
3
4

Solution:

what should be the output of this code block?

 public class abekus {

  public static void main(String[] args) {

   char[] a = {

    'A',

    'S',

    'I',

    'S',

    'H'

   };

   int i = 4;

   do {

    System.out.print(a[i]);

    i--;

   } while (i > 0);

  }

 }

1
2
3
4

Solution:

What is the output of the following code?

class Test {

public static void main(String[] args) {

int a, b, c, d;

a = b = c = d = 20;

a += b -= c *= d /= 20;

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

}

}

1
2
3
4

Solution:

What is the correct output of the following java program?

 class Abekus {

  public static void show() {

 System.out.println("Abekus::show() called");

 }

}

class Derived extends Abekus {

 public static void show() {

 System.out.println("Derived::show() called");

 }

}

public class Main {

 public static void main(String[] args) {

  Abekus a = new Abekus();;

  a.show();

 }

}

1
2
3
4

Solution: