Skip to content
C

Interview Questions

Java Interview Questions

Java interview questions and answers, organized by topic, with examples and key points for quick revision.

Core Java

Java fundamentals — the JVM, JDK, JRE, bytecode, and how a Java program actually runs.

Open 12 questions

OOP

Object-oriented programming as a paradigm — the four pillars, class relationships, and design guidelines.

Open 3 questions

Classes & Objects

Classes, objects, instance vs static members, and object initialization.

Open 6 questions

Constructors

Constructors, overloading, chaining, and common constructor pitfalls.

Open 4 questions

Inheritance

Inheritance, the super keyword, method hiding, and the diamond problem.

Open 4 questions

Polymorphism

Compile-time vs runtime polymorphism, dynamic dispatch, and upcasting/downcasting.

Open 11 questions

Encapsulation

Data hiding, access modifiers, and designing classes that protect their own state.

Open 2 questions

Abstraction

Hiding implementation detail behind abstract classes and interfaces.

Open 1 question

Strings

String immutability, the String Pool, StringBuilder/StringBuffer, and common String methods.

Open 4 questions

Arrays

Array basics, multidimensional arrays, copying, sorting, and searching.

Open 2 questions

Collections

List/Set/Queue/Map implementations, Comparable vs Comparator, HashMap internals, and fail-fast iteration.

Open 12 questions

Exception Handling

Checked vs unchecked exceptions, try-with-resources, custom exceptions, and exception propagation.

Open 6 questions

Multithreading

Thread creation, synchronization, deadlock, volatile, locks, and the Executor framework.

Open 8 questions

Java 8+

Lambdas, functional interfaces, the Stream API, Optional, and default/static interface methods.

Open 8 questions

Interfaces

Interface contracts, multiple implementation, interface inheritance, and functional/marker interfaces.

Open 2 questions

Abstract Classes

Abstract class mechanics, constructors and fields, and a deep comparison with interfaces.

Open 1 question

Generics

Generic classes and methods, bounded types, wildcards, PECS, and type erasure.

Open 4 questions

JVM

JVM architecture, class loading, runtime data areas, garbage collection, and common memory errors.

Open 7 questions

JDBC

Connecting Java to a database — drivers, statements, transactions, batching, and connection pooling.

Open 2 questions

Spring

Core Spring Framework ideas — dependency injection, inversion of control, and building loosely coupled components.

Open 2 questions

Spring Boot

Spring Boot fundamentals — auto-configuration on top of Spring, and building REST controllers quickly.

Open 2 questions

JPA / Hibernate

Object-relational mapping in Java — the JPA specification and its most common implementation, Hibernate.

Open 2 questions

REST API

REST API fundamentals for Java backends — resources, HTTP verbs, and stateless design.

Open 1 question

Advanced Java

Object class internals, varargs, initializer blocks, type conversions, wrapper classes, and modern Java language features from records to text blocks.

Open 15 questions