Java Interview Questions for 3 years Experience

At around 3 years of experience, interviews typically test solid command over OOPs, collections, exception handling, and basic multithreading. Here are commonly asked questions.

1. What is the difference between method overloading and overriding?

Overloading involves multiple methods with the same name but different parameters in the same class, resolved at compile time. Overriding involves a subclass redefining a superclass method, resolved at runtime.

2. What are the four pillars of OOPs?

Encapsulation, Abstraction, Inheritance, and Polymorphism — each contributing to writing modular, reusable, and maintainable code.

3. What is the difference between checked and unchecked exceptions?

Checked exceptions must be declared or handled at compile time (e.g., IOException), while unchecked exceptions occur at runtime and extend RuntimeException (e.g., NullPointerException).

4. What is the purpose of the finally block?

The finally block always executes after a try-catch, regardless of whether an exception was thrown, and is typically used for cleanup tasks like closing resources.

5. What is the difference between ArrayList and LinkedList?

ArrayList is backed by a dynamic array and offers fast random access; LinkedList is backed by a doubly linked list and offers faster insertions/deletions.

6. What is a HashMap, and how are duplicate keys handled?

HashMap stores key-value pairs; if a duplicate key is inserted, the new value simply replaces the existing value for that key.

7. What is the difference between == and equals()?

== compares object references (memory addresses), while equals() compares the actual content, though its behavior depends on whether it's overridden.

8. What is multithreading, and how do you create a thread?

Multithreading allows concurrent execution of two or more parts of a program. Threads can be created by extending the Thread class or implementing the Runnable interface.

9. What is the difference between an abstract class and an interface?

An abstract class can have both abstract and concrete methods along with state, and supports single inheritance. An interface primarily declares methods (with optional default methods) and supports multiple inheritance.

10. What is the use of the static keyword?

The static keyword creates members that belong to the class rather than any specific instance, shared across all objects of that class.

At this level, expect a mix of conceptual questions plus a short coding exercise — practicing common problems like reversing strings, finding duplicates, and basic collection manipulation pays off.

Master Java with Uncodemy

Hands-on training, live projects, and placement support in our Java Programming Course.

Explore the Course