Logo

Java Questions Set 235:

Quiz Mode

 Method overriding is a combination of inheritance and polymorphism 

1
2

Solution:

 if we try to use synchronized blocks for primitives we get a compile-time error.

1
2

Solution:

 Which of the following matches end of the string using regular expression in java 

1
2
3
4

Solution:

Loose coupling in java programs can be done by

1
2
3
4

Solution:

What is the scope of the public access modifier?

1
2
3
4

Solution:

What will be the output of the following Java program?

class Output

{

public static void main(String args[])

{

int a = Character.MAX_VALUE;

System.out.print((char)a);

}

}

1
2
3
4

Solution:

How many times 'abekus' is printed?

public class abekus

{

public static void main(String[] args) {

   while(true){

    System.out.println("abekus");

   break;

  }

}

}

1
2
3
4

Solution:

To avoid serialization of a new class whose superclass already implements Serialization, which of the following methods should be used?

1
2
3
4

Solution:

What is the correct output?

public class Abekus {

 static int x = 5;

 public static void main(String[] args) {

  Abekus myObj = new Abekus();

  System.out.println(x);

 }

}

1
2
3
4

Solution:

Choose the correct option to import the correct package.

We have some lines of code in the java file named b.java.

public class b{

public static void main(String args[])

{

Pattern p=Pattern.compile();

}

}

1
2
3
4

Solution: