Comprehensive Java Interview Topics: Language Basics, Collections, Concurrency, JVM, Design Patterns, MySQL, and Netty

This article compiles essential Java interview questions covering language fundamentals, core APIs, collections, concurrency mechanisms, JVM internals, design patterns, database concepts, and Netty networking, providing a thorough reference for candidates preparing for backend development positions.

Big Data Technology & Architecture
Big Data Technology & Architecture
Big Data Technology & Architecture
Comprehensive Java Interview Topics: Language Basics, Collections, Concurrency, JVM, Design Patterns, MySQL, and Netty

Java Language Basics : differences between final, finally, and finalize; role and implementation of final; exception hierarchy and distinction between Exception, Error, and runtime exceptions; common runtime exceptions; differences between int and Integer including caching range; autoboxing and unboxing; string manipulation techniques; comparison of String, StringBuilder, and StringBuffer; equality vs. hashCode behavior.

Collections : distinctions among List, Set, and Map; differences between ArrayList, LinkedList, Vector, HashMap, HashSet, TreeMap; relationship between Set and hashCode/equals; internal workings of HashMap including red‑black tree conversion, hash collisions, DOS attacks, and multithreaded dead‑loop issues; comparison of HashMap vs. ConcurrentHashMap; implementation of ConcurrentHashMap and element counting; guidelines for writing a simple HashMap and reviewing source code of collection classes; differences between Collection and Collections; thread‑safe collection options.

Concurrency & Multithreading : differences between threads, processes, and programs; daemon vs. non‑daemon threads; concepts of parallelism and concurrency; thread creation methods; inter‑process communication; context switching; Java thread scheduling algorithm; thread starvation and priority; sleep, join, yield differences; ThreadLocal usage and pitfalls; interrupted vs. isInterrupted; thread‑pool types, parameters, rejection policies, shutdown methods, tuning guidelines, and size determination (CPU cores + 1); Callable, Future, FutureTask; Fork/Join framework; synchronization primitives ( synchronized, ReentrantLock, fairness); lock types (biased, lightweight, heavyweight); lock escalation (spin, removal, expansion); Java Memory Model (JMM) and happens‑before principle; atomic classes ( AtomicInteger) and CAS issues; common concurrent containers (e.g., CopyOnWriteArrayList); blocking queue implementations and characteristics; semaphore, CountDownLatch, CyclicBarrier, Exchanger usage.

JVM : components of the JVM; runtime memory region layout; common OOM and stack overflow scenarios with causes and solutions; object reachability analysis; garbage‑collection algorithms and their meanings; monitoring tools such as jps, jstat, jmap, jinfo, jconsole; JVM parameter configuration and performance tuning; class‑loader hierarchy, parent‑delegation model, lifecycle, and loading steps (load, verify, prepare, resolve, initialize); reference types (strong, soft, weak, phantom); JMM details; changes to PermGen/MetaSpace in JDK 8 and sizing; heap vs. stack differences; object creation process; various GC collectors and differences between G1 and CMS; object allocation rules; diagnosing frequent Full GC; class‑loading mechanisms and breaking parent‑delegation (e.g., in Tomcat); JIT compilation basics.

Design Patterns : common patterns and the six SOLID principles; usage of design patterns in Spring and MyBatis; practical applications; analysis of pattern usage in open‑source frameworks; emphasis on singleton patterns (nine variations) and their trade‑offs; dynamic proxy importance.

Databases (MySQL) : index principles, full‑text and inverted indexes; left‑most prefix rule; three normal forms; pessimistic vs. optimistic locking; join types (inner, left, right, outer, cross, Cartesian product); recovery procedures for database outages (WAL, double‑write, checkpoint); redo/undo logs; isolation implementation; ACID properties and their enforcement; composite index behavior and failure cases; dead‑lock resolution; concurrency handling via transactions, isolation levels, and locks; MVCC mechanism and related issues; handling phantom reads; index usage best practices; DDL/DML/DCL definitions; EXPLAIN command; transaction isolation levels (READ UNCOMMITTED, READ COMMITTED, REPEATABLE READ, SERIALIZABLE) and phenomena (dirty read, non‑repeatable read, phantom read); sharding and partitioning design and distributed challenges; SQL optimization techniques; InnoDB vs. MyISAM differences; B+Tree, hash, and full‑text index types; adaptive hash index (AHI); reasons for using B+Tree; clustered vs. non‑clustered indexes; index invalidation scenarios and solutions; master‑slave replication workflow, consistency guarantees, and latency mitigation; backup strategies; performance issue with large LIMIT queries; data‑storage selection; distributed ID design; overall database optimization practices.

Netty : distinction and relationship among BIO, NIO, and AIO; Netty overview and typical use cases; high‑performance techniques (reactor model, off‑heap memory, memory pools, queue optimization, lock reduction, memory‑leak detection); reliability and extensibility features; core components; thread model; handling TCP sticky‑packet and fragmentation; supported serialization protocols; zero‑copy implementation; addressing NIO epoll bugs; idle detection; reconnection strategies; advantages of Netty’s ByteBuf; memory management and leak detection mechanisms; notable Netty source code sections.

Overall, this compilation serves as a detailed study guide for Java backend interview preparation, covering language fundamentals, core libraries, concurrency, JVM internals, design patterns, database fundamentals, and high‑performance networking with Netty.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Design PatternsJavaJVMBackend DevelopmentconcurrencyNettymysqlInterview Preparation
Big Data Technology & Architecture
Written by

Big Data Technology & Architecture

Wang Zhiwu, a big data expert, dedicated to sharing big data technology.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.