Set - 2

Question 31 :

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

Answer :

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


Question 32 :

What is the difference between a Window and a Frame?

Answer :

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


Question 33 :

What is the difference between a Window and a Frame?

Answer :

Heavy weight components like Abstract Window Toolkit (AWT), depend on the local windowing toolkit. For example, java.awt.Button is a heavy weight component, when it is running on the Java platform for Unix platform, it maps to a real Motif button. In this relationship, the Motif button is called the peer to the java.awt.Button. If you create two Buttons, two peers and hence two Motif Buttons are also created. The Java platform communicates with the Motif Buttons using the Java Native Interface. For each and every component added to the application, there is an additional overhead tied to the local windowing system, which is why these components are called heavy weight.


Question 34 :

Which package has light weight components?

Answer :

javax.Swing package. All components in Swing, except JApplet, JDialog, JFrame and JWindow are lightweight components.


Question 35 :

What are peerless components?

Answer :

The peerless components are called light weight components.