1. Described heavy weight components mean in Java Programming?

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 heavyweight.

2. Can you please explain the difference between Boolean & operator and the && operator in Java Programming?

If an expression involving the Boolean & operator is evaluated, both operands are evaluated. Then the & operator is applied to the operand. When an expression involving the && operator is evaluated, the first operand is evaluated. If the first operand returns a value of true then the second operand is evaluated. The && operator is then applied to the first and second operands. If the first operand evaluates to false, the evaluation of the second operand is skipped.
Operator & has no chance to skip both sides evaluation and && operator does. If asked why, give details as above.

3. Does the garbage collection guarantee that a program will not run out of memory?

No, it doesn't. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection.

4. Described the elements of a GridBagLayout organized in Java Programming?

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.

5. What advantage do Java's layout managers provide over the traditional windowing systems?

Java uses layout managers to lay out components in a consistent manner across all windowing platforms. Since Java's layout managers aren't tied to absolute sizing and positioning, they are able to accommodate platform-specific differences among windowing systems.

6. How a GUI component handle its own events in Java Programming?

A component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener.

7. Name primitive Java types?

The primitive types are byte, char, short, int, long, float, double, and boolean.

8. Explain the difference between Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy in Java Programming?

The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.

9. Does a class inherit constructors of its superclass in Java Programming?

A class does not inherit constructors from any of its superclasses.

10. Define Map interface in Java Programming?

The Map interface replaces the JDK 1.1 Dictionary class and is used associate keys with values.

Download Interview PDF