Advanced Java Questions and Answer for Interview
101. What is the relationship between clipping and repainting?
When a window is repainted by the AWT painting thread, it sets the clipping regions to the area of the window that requires repainting.
102. Is "abc" a primitive value?
String literal "abc" is not a primitive value. It is a
103. What is the relationship between an event-listener interface and an event-adapter class?
An event-listener interface defines the methods that must be implemented by an event handler for a particular kind of event.
An event adapter provides a default implementation of an event-listener interface.
104. What restrictions are placed on the values of each case of a switch statement?
During compilation, the values of each case of a
switch statement must evaluate to a value that can be promoted to an
105. What modifiers may be used with an interface declaration?
An interface may be declared as
106. Is a class a subclass of itself?
A class is a subclass of itself.
107. What is the highest-level event class of the event-delegation model?
java.util.EventObject class is the highest-level class in the event-delegation class hierarchy.
108. What event results from the clicking of a button?
ActionEvent event is generated as the result of the clicking of a button.
109. How can a GUI component handle its own events?
A component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener.
110. How are the elements of a GridBagLayout organized?
The elements of a
GridBagLayout are organized according to a grid. However, the elements are of different sizes and may occupy more than one row or column of the grid. In addition, the rows and columns may have different sizes.