Swing AWT Interview Questions

1 Q What is JFC?
A JFC stands for Java Foundation Classes. The Java Foundation Classes (JFC) are a set of Java class libraries provided as part of Java 2 Platform, Standard Edition (J2SE) to support building graphics user interface (GUI) and graphics functionality for client applications that will run on popular platforms such as Microsoft Windows, Linux, and Mac OSX.
2 Q What is AWT?
A AWT stands for Abstract Window Toolkit. AWT enables programmers to develop Java applications with GUI components, such as windows, and buttons. The Java Virtual Machine (JVM) is responsible for translating the AWT calls into the appropriate calls to the host operating system.
3 Q What are the differences between Swing and AWT?
A AWT is heavy-weight components, but Swing is light-weight components. AWT is OS dependent because it uses native components, But Swing components are OS independent. We can change the look and feel in Swing which is not possible in AWT. Swing takes less memory compared to AWT. For drawing AWT uses screen rendering where Swing uses double buffering.
4 Q What are heavyweight components ?
A A heavyweight component is one that is associated with its own native screen resource (commonly known as a peer).
5 Q What is lightweight component?
A A lightweight component is one that “borrows” the screen resource of an ancestor (which means it has no native resource of its own — so it’s “lighter”).
6 Q What is double buffering ?
A Double buffering is the process of use of two buffers rather than one to temporarily hold data being moved to and from an I/O device. Double buffering increases data transfer speed because one buffer can be filled while the other is being emptied.
7 Q What is an event?
A Changing the state of an object is called an event.
8 Q What is an event handler ?
A An event handler is a part of a computer program created to tell the program how to act in response to a specific event.
9 Q What is a layout manager?
A A layout manager is an object that is used to organize components in a container.
10 Q What is clipping?
A Clipping is the process of confining paint operations to a limited area or shape.
11 Q Which containers use a border Layout as their default layout?
A The window, Frame and Dialog classes use a border layout as their default layout.
12 Q What is the preferred size of a component?
A The preferred size of a component is the minimum component size that will allow the component to display normally.
13 Q What method is used to specify a container’s layout?
A The setLayout() method is used to specify a container’s layout.
14 Q Which containers use a FlowLayout as their default layout?
A The Panel and Applet classes use the FlowLayout as their default layout.

No comments:

Post a Comment