Target Versions: JDK 17 (LTS), JDK 21 (LTS), JDK 23 (Preview) Goal: From "Hello World" to High-Performance Cloud Architect. Philosophy: Spec-First, Memory-Aware, Cloud-Native.
- JDK vs JRE vs JVM: Distinctions for containerization (Distroless images).
- The Toolchain:
javac(Compiler),java(Launcher),javap(Disassembler),jar. - Classfiles: Structure, Bytecode basics, and Verification.
- The Classpath:
-cp, JAR hell, and dependency resolution fundamentals.
- Stack Memory: Frames, Primitives, Object References.
- Heap Memory: Objects, String Pool, Metaspace (Class Metadata).
- Execution Engine: Interpreter vs JIT (C1/C2) vs AOT (GraalVM).
- Internal Representation:
Stringimmutability, Compact Strings (JDK 9+byte[]optimization). - Memory Management: The String Pool,
String.intern(), and Deduplication (G1GC). - Mutation:
StringBuilder(Single-threaded perf) vsStringBuffer(Legacy thread-safe). - Manipulation:
substring(Memory implications),split(Regex costs) vsStringTokenizer. - Text Blocks: Multiline strings, indentation management (JDK 15+).
- Encoding:
char(UTF-16) vsbyte,StandardCharsets.UTF_8, and Unicode surrogates.
- The Legacy Trap: Why
java.util.DateandCalendarare banned (Mutability, Thread-safety). - The Modern API (JSR-310):
Instant: Machine time (UTC), epoch timestamps.LocalDateTime: Wall-clock time (context-less).ZonedDateTime&OffsetDateTime: Timezone aware, ISO-8601 compliance.
- Durations & Periods:
Duration(Time-based: nanos/seconds).Period(Date-based: days/months/years).
- Manipulation:
TemporalAdjusters(First day of month, Next Tuesday). - Formatting:
DateTimeFormatter(Thread-safety) vsSimpleDateFormat(Legacy/Broken). - Timezones:
ZoneId, DST rules, handling ambiguous times (Fall back/Spring forward).
- The 8 Primitives: Sizes, ranges, and default values.
- Wrappers & Auto-boxing:
Integercache, memory overhead, performance pitfalls. - Variable Inference:
varkeyword usage and readability guidelines.
- Branching:
if,else, ternary operators. - Modern Switch: Switch Expressions (yield), Pattern Matching for Switch (JDK 17/21).
- Loops:
for, Enhancedfor,while,do-while, Loop unrolling concepts. - Jump Statements:
break,continue, Labeled loops.
- Members: Fields, Methods, Constructors.
- Initialization Order: Static Blocks -> Instance Blocks -> Constructors.
- Access Modifiers:
public,protected, package-private,private. - The
finalKeyword: Classes, Methods, Variables (Immutability).
- Records (JDK 17): Canonical constructors, compact constructors, data-carrier semantics.
- Sealed Classes (JDK 17): Permitted subclasses, hierarchy control, switch exhaustiveness.
- Interfaces: Default methods, Static methods, Private interface methods.
- Enums: Advanced Enum patterns, constant-specific class bodies.
- Nested Classes: Static Nested vs Inner vs Anonymous classes.
- Syntax: Type parameters
<T>, Generic Classes, Generic Methods. - Type Erasure: Compile-time checks vs Runtime representation (
Objectcasting). - Constraints: Bounded Type Parameters (
<T extends Number>).
- Wildcards: Unbounded
<?>, Upper Bounded<? extends T>, Lower Bounded<? super T>. - PECS Principle: Producer Extends, Consumer Super.
- Heap Pollution: Varargs and generics hazards.
- Lists:
ArrayList(Resizing logic) vsLinkedList(Node overhead). - Sets:
HashSet(HashMap backing),TreeSet(Red-Black Tree),LinkedHashSet. - Queues/Deque:
PriorityQueue(Heap),ArrayDeque(Ring buffer).
- HashMap Internals: Buckets, HashCode/Equals contract, Collision resolution (Chaining -> Treeification).
- Map Variants:
LinkedHashMap(LRU Cache capability),IdentityHashMap,EnumMap. - Complexity Analysis: Big-O notation for Insert/Delete/Search per structure.
- Core Interfaces:
Function,Predicate,Consumer,Supplier. - Lambdas: Syntax, Method References (
::), Scope/Closure (Effectively final).
- Pipeline: Source -> Intermediate (Lazy) -> Terminal (Eager).
- Operations:
map,filter,flatMap,reduce,collect. - Collectors:
groupingBy,partitioningBy,joining, Custom Collectors. - Parallel Streams: ForkJoinPool, splitting heuristics, performance hazards.
- Throwable:
Error(JVM failures) vsException. - Checked vs Unchecked: Architecture decision guidelines (
RuntimeExceptionvsIOException). - Handling:
try-catch-finally,try-with-resources(AutoCloseable).
- Best Practices: Exception wrapping, suppressing exceptions, StackTrace costs.
- Anti-patterns: Swallowing exceptions, Control flow via exceptions.
- Dependency Management: Transitive dependencies, BOMs, Scope (Test/Provided/Runtime).
- Lifecycle: Clean, Compile, Test, Package, Verify, Install, Deploy.
- Plugins: Compiler, Surefire (Test), Shade/FatJar.
- Module Info:
requires,exports,opens,provides/uses. - The Graph: Module path vs Classpath.
- Encapsulation: Strong encapsulation boundaries.
- Built-in:
@Override,@Deprecated,@FunctionalInterface. - Custom Annotations: Meta-annotations (
@Retention,@Target).
- Reflection API: Accessing private members, dynamic instantiation (Performance cost).
- Annotation Processing: Pluggable Annotation Processing API (Lombok mechanics, MapStruct).
- Generational Hypothesis: Young Gen (Eden, Survivor S0/S1) vs Old Gen.
- Allocation: TLABs (Thread Local Allocation Buffers), Escape Analysis (Stack Allocation).
- The Algorithms: Serial, Parallel, G1GC (Region based), ZGC (Generational/Low Latency).
- Tuning:
-Xmx,-Xms, GC Logging, analyzing pauses (Stop-The-World). - Troubleshooting:
OutOfMemoryErrortypes, Heap Dump analysis (Eclipse MAT).
- Concepts: Atomicity, Visibility, Ordering.
- Happens-Before Relationship: The rules of memory consistency.
- Keywords:
volatile(Visibility guarantees),synchronized(Monitor locks).
- Lifecycle: New, Runnable, Blocked, Waiting, Terminated.
- Inter-thread Communication:
wait,notify,notifyAll(Spurious wakeups). - Hazards: Deadlocks, Livelocks, Race Conditions.
- Executors:
ThreadPoolExecutor,ForkJoinPool. - Future API:
Future,CompletableFuture(Async pipelines). - Synchronization Aids:
CountDownLatch,CyclicBarrier,Semaphore. - Locks:
ReentrantLock,ReadWriteLock,StampedLock.
- Architecture: Carrier Threads vs Virtual Threads (M:N Scheduling).
- Blocking: The cost of blocking in Virtual vs Platform threads.
- Structured Concurrency: Scope, supervision, error handling hierarchies (Preview).
- Maps:
ConcurrentHashMap(Segment locking vs CAS). - Queues:
BlockingQueue(ArrayBlockingQueue,LinkedBlockingQueue),TransferQueue. - Lists:
CopyOnWriteArrayList(Read-heavy use cases).
- JUnit 5: Lifecycle (
@BeforeAll,@Test), Parameterized Tests, Assertions. - Mocking: Mockito (Stubs, Spies, Verify), Strictness levels.
- TestContainers: Ephemeral Docker instances for DBs/Brokers.
- Benchmarks: JMH (Java Microbenchmark Harness) - Avoiding JVM warmup traps.
- Core:
DataSource,Connection,PreparedStatement(SQL Injection prevention). - Transactions: ACID properties, Isolation Levels, Commit/Rollback.
- Entity Lifecycle: Transient, Managed, Detached, Removed.
- Mapping:
@Entity,@Id,@OneToMany,@ManyToOne. - Performance: N+1 Select Problem, Lazy vs Eager loading, L1/L2 Cache.
- Hierarchy: Bootstrap -> Platform -> App ClassLoader.
- Delegation Model: Parent-first delegation.
- Dynamic Loading:
Class.forName(), Context ClassLoaders.
- Dynamic Proxies: Interface-based (
java.lang.reflect.Proxy). - CGLIB/ByteBuddy: Class-based proxies (Spring mechanics).
- Logging: SLF4J (Facade) vs Logback/Log4j2, Structured Logging (JSON).
- Metrics: Micrometer, Prometheus exposition formats.
- Tracing: OpenTelemetry, Correlation IDs, Distributed context propagation.
- Patterns: Circuit Breaker, Bulkhead, Rate Limiter, Retry (Resilience4j).
- Configuration: Externalized Config (12-Factor App).
- Messaging: JMS (Legacy) vs Kafka/RabbitMQ concepts.
- Patterns: Outbox Pattern, Saga Pattern (Orchestration vs Choreography).
- Consistency: Eventual Consistency, Idempotency keys.
- Layered: Controller -> Service -> Repository.
- Hexagonal (Ports & Adapters): Domain isolation.
- Modular Monolith: Package-by-feature, strict boundaries.
- Comparison: Java Interfaces vs Go Interfaces.
- Concurrency: Virtual Threads vs Goroutines.
- Error Handling: Exceptions vs Go
errorvalues. - Deployment: JRE Containers vs Go Static Binaries.