Core Java Interview Questions – Set 08

What values of the bits are shifted in after the shift

In case of signed left shift >> the new bits are set to zero. But in case of signed

right shift it takes the value of most significant bit before the shift, that is if the most

significant bit before shift is 0 it will introduce 0, else if it is 1, it will introduce 1

What happens when you add a double value to a String

The result is a String object.

Are there any global variables in Java, which can be accessed by other part of your program?-

No, it is not the main method in which you define variables. Global variables is not possible because concept of encapsulation is eliminated here.

What is the Dictionary class

The Dictionary class provides the capability to store key-value pairs.

Which Container method is used to cause a container to be laid out and redisplayed

validate() method is used to cause a container to be laid out and redisplayed

Why is the main method static

Ans: So that it can be invoked without creating an instance of that class

Can abstract modifier be applied to a variable

No it is applied only to class and methods

Which Java operator is right associative?

The = operator is right associative.

Can a lock be acquired on a class?

Yes, a lock can be acquired on a class. This lock is acquired on the class’s Class object

What is the highest-level event class of the event-delegation model

The java.util.EventObject class is the highest-level class in the event-delegation class hierarchy.