Essential Java Interview Questions Every Backend Developer Should Master
A comprehensive collection of Java interview questions covering fundamentals, common collections, concurrency, JVM internals, design patterns, data structures, networking, databases, caching, messaging, frameworks, distributed systems, and micro‑service architecture to help developers prepare for junior to mid‑level positions.
1. Basics
1.1 Java Fundamentals
Object‑oriented features: inheritance, encapsulation, polymorphism
Differences between final, finally, and finalize
Exception, Error, runtime exceptions vs. checked exceptions
Five common runtime exceptions
Difference between int and Integer, Integer cache range
Boxing and unboxing
String, StringBuilder, StringBuffer
Method overloading vs. overriding
Abstract class vs. interface
Uses and implementation of reflection
Custom annotation scenarios and implementation
GET vs. POST HTTP methods
Session vs. Cookie
Commonly used JDK packages
MVC design concept
Difference between equals and ==
Relationship between hashCode and equals
Java serialization, Serializable interface purpose
Common Object class methods; why wait/notify are in Object
How Java achieves platform independence
Difference between JDK and JRE
New features in Java 8
1.2 Common Java Collections
Difference between List and Set
Relation of Set with hashCode and equals
Difference between List and Map
ArrayList vs. LinkedList
ArrayList vs. Vector
HashMap vs. Hashtable
HashSet vs. HashMap
HashMap vs. ConcurrentHashMap
HashMap internal working, when red‑black tree is used
HashMap dead‑loop issue under multithreading
Hash DOS attack problem
ConcurrentHashMap implementation and element counting
Write a simple HashMap
Review of source code of common collection classes
1.3 Processes and Threads
Concepts of process, thread, parallelism, concurrency
Ways to create a thread
Inter‑process communication methods
CountDownLatch vs. CyclicBarrier principles
Semaphore principle
Exchanger principle
ThreadLocal analysis and OOM cause
Thread pool implementation principles
Various thread‑pool implementations
Thread lifecycle and state transitions
1.4 Lock Mechanisms
What thread safety means and how to guarantee it
Re‑entrant lock concept and dead‑lock prevention
Four conditions that cause dead‑lock
How to detect dead‑lock (e.g., via jConsole)
volatile implementation (preventing instruction reordering, memory flush)
synchronized implementation (object monitor)
Difference between synchronized and lock
AQS synchronization queue
CAS lock‑free concept, optimistic vs. pessimistic lock
Common atomic operation classes
ABA problem and JDK solution
Business scenarios for optimistic lock
Common concurrent classes in java.util.concurrent
Biased, lightweight, heavyweight, and spin locks
1.5 JVM
JVM runtime memory regions
OOM and SOE examples, causes, diagnosis, and solutions
How to determine if an object is eligible for GC
Common GC algorithms and their meanings
JVM monitoring and troubleshooting tools: jps, jstat, jmap, jinfo, jconsole
How to set JVM parameters
JVM performance tuning
Class loader, parent‑delegation model, class lifecycle
Class loading phases: loading, verification, preparation, resolution, initialization
Strong, soft, weak, and phantom references
Java Memory Model (JMM)
1.6 Design Patterns
Common design patterns
Six SOLID principles and their meanings
Typical singleton implementations and trade‑offs
Practical applications of design patterns
Design patterns used in Spring
Design patterns used in MyBatis
Design patterns you have used in projects
Analysis of design‑pattern usage in popular frameworks
Importance of dynamic proxies
1.7 Data Structures
Trees: binary search tree, balanced BST, red‑black tree, B‑tree, B+‑tree
Depth‑first and breadth‑first algorithms
Kruskal, Prim, Dijkstra algorithms
Consistency concepts, hash principles, hash ring issues
Common sorting and searching algorithms: quicksort, binary search, heap sort
1.8 Network / I/O Basics
BIO, NIO, AIO concepts
Long connection vs. short connection
Differences between HTTP/1.0 and HTTP/2.0
Basic HTTPS concepts
Three‑way handshake and four‑way termination
What happens from entering a URL to page load
2. Data Storage and Messaging
2.1 Databases
MySQL index usage considerations
DDL, DML, DCL definitions
EXPLAIN command
LEFT JOIN, RIGHT JOIN, INNER JOIN
Database transaction ACID properties
Transaction isolation levels
Dirty read, phantom read, non‑repeatable read
Database normalization forms
Common database commands
Sharding and partitioning design
Distributed challenges of sharding and solutions
SQL optimization strategies
MySQL dead‑lock detection and resolution
InnoDB vs. MyISAM storage engines
Index types (B+‑tree, full‑text, hash) and principles
Adaptive hash index (AHI)
Why B+‑tree is used for MySQL indexes
Clustered vs. non‑clustered index differences
Index invalidation scenarios and fixes
Performance issue with large LIMIT queries
Choosing a distributed primary‑key strategy
Selecting appropriate data storage solutions
Common distributed ID design schemes
Database optimization practices in real projects
2.2 Redis
Redis data types
Redis internal structure
Redis use cases
Redis persistence mechanisms (RDB, AOF)
Redis clustering solutions and implementation
Why Redis is single‑threaded
Cache avalanche, penetration, pre‑warming, update, degradation
Reasonable use of caching
Redis eviction policies
2.3 Message Queues
Message‑queue usage scenarios
Message retry and compensation strategies
Message idempotency solutions
Message backlog handling
How to implement a custom message queue
Ensuring message ordering
3. Open‑Source Frameworks and Containers
3.1 SSM / Servlet
Servlet lifecycle
Forward vs. redirect
BeanFactory vs. ApplicationContext
Spring Bean lifecycle
Spring IoC implementation
Spring Bean scopes
Spring AOP principles and implementation
Dynamic proxies (CGLib vs. JDK) comparison
Spring transaction mechanisms and propagation
Underlying principles of Spring transactions
Spring transaction pitfalls with JDK dynamic proxies
Custom annotation implementation
Spring MVC request processing flow
Spring MVC startup flow
Spring singleton implementation
Design patterns used inside Spring
Spring ecosystem (Boot, Cloud, Security, Data, AMQP, etc.)
Spring Boot concepts and principles
MyBatis fundamentals
3.2 Netty
Reasons to choose Netty
Netty use cases in business
JDK 1.7 NIO epoll bug
TCP packet sticking and splitting
Solutions for TCP stick/split problems
Netty threading model
Netty zero‑copy technique
Netty internal execution flow
Netty reconnection implementation
3.3 Tomcat
Tomcat architecture (Server, Service, Connector, Container)
How Tomcat loads Servlets
Pipeline‑Valve mechanism
4. Distributed Systems
4.1 Nginx
C10K problem explanation
Nginx overview
Forward proxy vs. reverse proxy
Common Nginx load‑balancing strategies
Master and Worker processes in Nginx
Advantages of using a reverse‑proxy server
4.2 Other Distributed Topics
Business scenarios for distributed architecture
Session distribution solutions
Distributed lock concepts, use cases, and common solutions
Distributed transaction solutions
Cluster and load‑balancing algorithms
Sharding design and implementation references
4.3 Dubbo
What Dubbo is
RPC concepts and implementation principles
Dubbo SPI concept
Dubbo core principles and execution flow
5. Microservices
5.1 Microservice Basics
Front‑end and back‑end separation
Common microservice frameworks
Spring Cloud components
Domain‑driven design (rich vs. anemic model)
JWT basics and usage
Understanding RESTful principles
Designing good APIs and ensuring idempotency
CAP theorem and BASE theory
Data consistency considerations and eventual consistency solutions
Pros and cons of microservices
Differences between microservices and SOA
Service decomposition strategies (horizontal vs. vertical)
Handling chain‑call failures in microservices
Rapid issue tracing and localization
Microservice security and authentication
5.2 Security Issues
Defending against common web attacks and SQL injection
Server‑side communication security
HTTPS fundamentals, downgrade attacks, HTTP vs. HTTPS comparison
5.3 Performance Optimization
Performance metrics
Identifying bottlenecks
Common performance‑tuning techniques
Personal experience with performance tuning in projects
6. Other Topics
6.1 Design Capability
UML diagrams used in projects
Componentization, service‑orientation, system decomposition considerations
Design of flash‑sale (seckill) scenarios
6.2 Business Engineering
Development workflow and automated deployment
Team communication practices
Code review processes
Understanding of technology vs. business
Challenging bugs and their resolutions
Valuable project experiences and lessons learned
6.3 Soft Skills
Personal strengths, weaknesses, and highlights
Current reading, blogs, new technologies, open‑source code exploration
Most meaningful technical books
Learning methods and self‑improvement strategies
Career development thoughts
Key abilities for a backend engineer
What makes a good architect and their responsibilities
Views on overtime work
Preparing thoroughly for these topics is essential for succeeding in Java developer interviews at junior and intermediate levels.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java Backend Technology
Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
