No description
- Java 100%
| .vscode | ||
| insights/spring | ||
| src | ||
| .gitignore | ||
| mysql_pod.yaml | ||
| pom.xml | ||
| README.md | ||
☕ Java Core Masterclass
A comprehensive Java learning project — from beginner fundamentals to senior interview-level deep dives.
Java 21 LTS · Maven · 39 runnable lessons
🚀 Quick Start
git clone <repository-url>
cd java-core
mvn clean compile
# Run any lesson directly
mvn exec:java -Dexec.mainClass="com.learning.exception.ExceptionErrorInsight"
| Requirement | Version |
|---|---|
| Java | 21 LTS |
| Maven | 3.9+ |
📚 Learning Roadmap
Follow the levels in order. Each builds on the previous one.
Level 1 — Foundations (Beginner)
Start here if you're new to Java. Learn how the language works from the ground up.
| # | Topic | File | What You'll Learn |
|---|---|---|---|
| 1 | Primitive Types | PrimitiveTypes.java |
8 data types, bytes/bits, memory layout |
| 2 | Operators | Operators.java |
Arithmetic, logical, bitwise, assignment |
| 3 | Control Flow | ControlFlow.java |
if-else, switch, loops |
| 4 | Arrays | ArraySystemInsight.java |
Single/multi-dimensional arrays, memory |
| 5 | Strings | StringPoolInsight.java |
String pool, interning, immutability |
| 6 | Stack vs Heap | StackVsHeapInsight.java |
Where data lives in memory |
Level 2 — Object-Oriented Programming
Understand how Java organizes code into objects.
| # | Topic | File | What You'll Learn |
|---|---|---|---|
| 7 | Classes & Objects | ClassesAndObjects.java |
Classes, constructors, this keyword |
| 8 | Object Anatomy | ObjectAnatomyInsight.java |
Object header, memory layout |
| 9 | Object Header | ObjectHeaderInsight.java |
Mark word, class pointer, lock bits |
| 10 | Method Execution | MethodExecutionInsight.java |
Stack frames, method dispatch |
| 11 | Records | RecordsDemo.java |
Java 14+ immutable data classes |
Level 3 — Collections & Memory
How Java stores and manages data structures in memory.
| # | Topic | File | What You'll Learn |
|---|---|---|---|
| 12 | Collections Overview | CollectionsOverview.java |
Hierarchy, choosing the right collection, golden rules |
| 13 | ArrayList | ArrayListInsight.java |
Growth 1.5x, internal Object[], cache-friendly, efficiency tips |
| 14 | LinkedList | LinkedListInsight.java |
Doubly-linked nodes, Deque API, why ArrayList almost always wins |
| 15 | HashSet | HashSetInsight.java |
Backed by HashMap, equals/hashCode contract, set operations |
| 16 | TreeSet | TreeSetInsight.java |
Red-Black Tree, NavigableSet API, floor/ceiling/subSet |
| 17 | HashMap Internals | HashMapInsight.java |
Buckets, hashing, tree-ification |
| 18 | HashMap Deep Dive | HashMapInternals.java |
Resize, load factor, collisions |
| 19 | TreeMap | TreeMapInsight.java |
Sorted map, NavigableMap, range queries, real-world examples |
| 20 | LinkedHashMap | LinkedHashMapInsight.java |
Insertion/access order, LRU cache in 5 lines |
| 21 | Queue & Deque | QueueDequeInsight.java |
ArrayDeque circular buffer, PriorityQueue heap, Top-K pattern |
| 22 | Concurrent Collections | ConcurrentCollectionsInsight.java |
ConcurrentHashMap, CopyOnWriteArrayList, BlockingQueue |
| 23 | Variable Memory | VariableMemoryInsight.java |
Where primitives vs objects live |
| 24 | Object Memory Layout | ObjectMemoryLayout.java |
Alignment, padding, field ordering |
Level 4 — Senior Deep Dives 🔥
The heart of this project. Each chapter is a comprehensive, interview-ready lesson with JVM internals, ASCII diagrams, runnable demos, and best practices.
| # | Topic | File | Key Concepts |
|---|---|---|---|
| 25 | Exception & Error | ExceptionErrorInsight.java |
Exception tables, fillInStackTrace() cost, try-with-resources internals, custom hierarchies |
| 26 | Async & Concurrency | AsyncPatternsInsight.java |
Thread pools, CompletableFuture, ForkJoinPool, Virtual Threads (Java 21) |
| 27 | Volatile & Locks | VolatileLockInsight.java |
JMM, happens-before, lock escalation, CAS atomics, deadlock prevention |
| 28 | Vavr Concepts | VavrConceptsInsight.java |
Option, Either, Try internals, validation pipelines, pattern matching |
| 29 | Java Functions | JavaFunctionsInsight.java |
java.util.function, type erasure, PECS rule, reading generic code |
| 30 | Functional Style | FunctionalStyleInsight.java |
Pure functions, Streams internals, Collectors, method references |
| 31 | Serialization | SerializationInsight.java |
Byte stream format, Serialization Proxy Pattern, Externalizable |
| 32 | JDBC & JPA | JdbcJpaInsight.java |
PreparedStatement, batch ops, N+1 problem, connection pooling, entity lifecycle |
| 33 | RMI | RmiInsight.java |
Stub-skeleton, marshalling, dynamic proxy, modern alternatives |
| 34 | Design Patterns | DesignPatternsInsight.java |
7 patterns with before/after refactoring + code smell guide |
| 35 | JVM Internals | JvmInternalsInsight.java |
GC algorithms (G1/ZGC), JVM flags, classloading, memory leaks, profiling |
| 36 | Architecture | ArchitectureInsight.java |
Hexagonal, package-by-feature, SOLID, DTO pattern |
| 37 | Testing | TestingInsight.java |
JUnit 5, Mockito, AssertJ, Testcontainers, TDD, anti-patterns |
Bonus
| # | Topic | File | What You'll Learn |
|---|---|---|---|
| 38 | Sorting Algorithms | SortingAlgorithms.java |
Bubble, Selection, Insertion, Merge, Quick |
| 39 | Interview Questions | JavaCoreQuestions.java |
Common senior interview topics |
📂 Project Structure
src/main/java/com/learning/
├── fundamentals/ # Level 1: Primitives, operators, arrays, strings, memory
│ ├── primitives/
│ ├── operators/
│ ├── controlflow/
│ ├── arrays/
│ ├── strings/
│ ├── memory/
│ └── objects/
├── oop/ # Level 2: Classes, objects, method dispatch
│ ├── classes/
│ ├── anatomy/
│ └── methods/
├── modern/ # Level 2: Records, sealed classes
├── collections/ # Level 3: All collection types
│ ├── list/ # ArrayList, LinkedList
│ ├── set/ # HashSet, TreeSet
│ ├── map/ # HashMap, TreeMap, LinkedHashMap
│ ├── queue/ # ArrayDeque, PriorityQueue
│ └── concurrent/ # ConcurrentHashMap, CopyOnWrite, BlockingQueue
├── memory/ # Level 3: Object layout, variable storage
├── exception/ # Level 4: Exception internals
├── concurrency/ # Level 4: Async, volatile, locks
├── functional/ # Level 4: Vavr, functions, streams
├── serialization/ # Level 4: Serializable internals
├── database/ # Level 4: JDBC & JPA
├── rmi/ # Level 4: Remote Method Invocation
├── patterns/ # Level 4: Design patterns & refactoring
├── jvm/ # Level 4: GC, JVM flags, classloading
├── architecture/ # Level 4: Hexagonal, SOLID, packaging
├── testing/ # Level 4: JUnit, Mockito, TDD
├── algorithms/ # Bonus: Sorting algorithms
└── interview/ # Bonus: Interview preparation
🏃 How to Run
Each file has a main() method. Run any lesson:
# Run a specific lesson
mvn compile exec:java -Dexec.mainClass="com.learning.concurrency.AsyncPatternsInsight"
# Run all tests
mvn test
# Build the project
mvn clean compile
📖 Recommended Reading
| Book | Why |
|---|---|
| Effective Java — Joshua Bloch | The Java bible. Patterns, pitfalls, best practices |
| Java Concurrency in Practice — Brian Goetz | Threading done right |
| Clean Code — Robert C. Martin | Writing maintainable software |
| Head First Design Patterns | Visual, beginner-friendly pattern intro |
🛠 Tools
| Tool | Purpose |
|---|---|
| VisualVM | CPU & memory profiling |
| JMH | Microbenchmarking |
| async-profiler | Low-overhead profiling |
| Eclipse MAT | Heap dump analysis |
License
This project is for educational purposes.