Behavioral Java Developer Interview Preparation Guide
Download PDF

Java Developer Frequently Asked Questions by expert members with experience in Java Developer. These questions and answers will help you strengthen your technical skills, prepare for the new job test and quickly revise the concepts

63 Java Developer Questions and Answers:

Table of Contents:

Behavioral  Java Developer Job Interview Questions and Answers
Behavioral Java Developer Job Interview Questions and Answers

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.

11 :: If the a class is declared without any access modifiers, where may the class be accessed in Java Programming?

A class that is declared without any access modifiers is said to have package or friendly access. This means that the class can only be accessed by other classes and interfaces that are defined within the same package.

12 :: Which classes of exceptions may be caught by a catch clause in Java Programming?

A catch clause can catch any exception that may be assigned to the Throwable type. This includes the Error and Exception types.

13 :: Can you please explain the difference between preemptive scheduling and time slicing in Java Programming?

Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other factors.

14 :: What happens when a thread cannot acquire lock on an object in Java Programming?

If a thread attempts to execute a synchronized method or synchronized statement and is unable to acquire an object's lock, it enters the waiting state until the lock becomes available.

15 :: Can you please explain the difference between Font and FontMetrics classes in Java Programming?

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

16 :: What are peerless components?

The peerless components are called light weight components.

17 :: Which package has the light weight components in Java Programming?

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

18 :: When an object reference be cast to an interface reference in Java Programming?

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

19 :: Can you please explain the difference between Window and a Frame in Java Programming?

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

20 :: Can you please explain the difference between static and a non-static inner class in Java Programming?

A non-static inner class may have object instances that are associated with instances of the class's outer class. A static inner class does not have any object instances.

21 :: Described object's lock and which object's have locks in Java Programming?

An object's lock is a mechanism that is used by multiple threads to obtain synchronized access to the object. A thread may execute a synchronized method of an object only after it has acquired the object's lock. All objects and classes have locks. A class's lock is acquired on the class's Class object.

22 :: Described abstract method in Java Programming?

An abstract method is a method whose implementation is deferred to a subclass in Java Programming.

23 :: What are high-level thread states in Java Programming?

The high-level thread states are ready, running, waiting, and dead.

24 :: What must class do to implement an interface in Java Programming?

It must provide all of the methods in the interface and identify the interface in its implements clause.

25 :: Described the purpose of the wait(), notify(), and notifyAll() methods in Java Programming?

The wait(),notify(), and notifyAll() methods are used to provide an efficient way for threads to communicate each other in Java Programming.
Java Developer Interview Questions and Answers
63 Java Developer Interview Questions and Answers