Explore a curated collection of Java interview questions covering a wide range of topics and difficulty levels—from beginner to advanced. Whether you’re just starting out or preparing for senior-level interviews, this page helps you practice effectively with clear questions, concise answers, and in-depth explanations.

Use the filter to quickly find questions by level and focus on the areas that matter most to you. Each question is designed to reinforce key concepts, improve your problem-solving skills, and prepare you for real-world technical interviews.

Start practicing, test your knowledge, and get interview-ready with structured, high-quality Java questions.

Stream API
Advanced

What is the advantage of splitting in streams?

Splitting allows data to be processed in parallel improving performance on multi-core systems.
Stream API
Advanced

What is a Spliterator in Java?

Spliterator is an advanced iterator used internally by streams to traverse and split data sources for parallel processing.
Functional Programming
Intermediate

What is the difference between static and inner classes?

Static nested classes do not require an instance of the outer class while inner classes are associated with an instance of the outer class.
Functional Programming
Intermediate

What are the different types of nested classes?

Nested classes include static nested classes inner classes local classes and anonymous classes each with different scope and usage.
Functional Programming
Intermediate

What are common functional interfaces in Java?

Examples include Predicate Function Consumer and Supplier which represent common patterns like testing transforming consuming and supplying values.
Functional Programming
Beginner

What is a functional interface?

A functional interface has exactly one abstract method and can be implemented using lambda expressions enabling functional programming in Java.
Functional Programming
Intermediate

What is the difference between expression lambda and block lambda?

Expression lambdas return a value implicitly while block lambdas use braces and require an explicit return statement.
Functional Programming
Beginner

What is the syntax of a lambda expression in Java?

A lambda expression consists of parameters arrow operator and body such as (x, y) -> x + y. The compiler infers types making code concise.
Functional Programming
Intermediate

When should you use a lambda instead of a nested class?

Use lambdas when implementing a functional interface with simple behavior. Use nested classes when you need multiple methods state or complex logic.
Functional Programming
Intermediate

What is the difference between a lambda expression and an anonymous class?

Lambda expressions provide a concise way to implement functional interfaces without boilerplate code while anonymous classes allow defining a full class with multiple methods and state.
Collections Framework
Beginner

What are the core interfaces of the Collections Framework?

The main interfaces are List Set Queue and Map which define different data structures and behaviors.
Collections Framework
Beginner

What is the Java Collections Framework?

It is a unified architecture providing interfaces and classes to store manipulate and process collections of objects efficiently.
Collections Framework
Intermediate

What is the time complexity of ArrayList operations?

Access is O(1) while insertion or deletion in the middle is O(n) due to shifting elements.
Collections Framework
Beginner

How does ArrayList work internally?

ArrayList uses a dynamic array that resizes when capacity is exceeded. It provides fast random access but resizing can be costly.
Collections Framework
Intermediate

When is LinkedList preferred over ArrayList?

LinkedList is preferred when frequent insertions and deletions occur especially in the middle while ArrayList is better for random access.
Collections Framework
Intermediate

How is LinkedList implemented internally?

LinkedList is implemented as a doubly linked list where each node contains references to previous and next nodes allowing efficient insertions and deletions.
Collections Framework
Advanced

What are the drawbacks of CopyOnWriteArrayList?

It has high memory and performance cost for write operations because every modification creates a new copy of the underlying array.
Collections Framework
Advanced

What is CopyOnWriteArrayList and when should you use it?

CopyOnWriteArrayList is a thread-safe list where modifications create a new copy of the array. It is useful when reads are frequent and writes are rare.
Collections Framework
Beginner

What is the difference between HashMap and TreeMap?

HashMap is unordered and faster while TreeMap maintains sorted order using a red-black tree with O(log n) operations.
Collections Framework
Intermediate

What are the main Map implementations in Java?

Common implementations include HashMap LinkedHashMap TreeMap and ConcurrentHashMap each differing in ordering concurrency and performance.