Advanced java technical interview question

79. When can an object reference be cast to an interface reference?

An object reference be cast to an interface reference when the object implements the referenced interface.

80. What is the difference between a Window and a Frame?

The Frame class extends Window to define a main application window that can have a menu bar.

81. Which class is extended by all other classes?

The Object class is extended by all other classes.

82. Can an object be garbage collected while it is still reachable?

A reachable object cannot be garbage collected. Only unreachable objects may be garbage collected..

83. Is the ternary operator written x : y ? z or x ? y : z ?

It is written x ? y : z.

84. What is the difference between the Font and FontMetrics classes?

The FontMetrics class is used to define implementation-specific properties, such as ascent and descent, of a Font object.

Leave a Reply0

Your email address will not be published.