From First Program to Production-Ready Systems with Java 26
Introduction: Why Java Still Matters
- The Numbers That Tell the Story
- From Applets to Virtual Threads
- What This Book Covers (and Doesn’t)
- Your First Milestone
- Versions Used in This Book
Chapter 1: Setting Up Your Java Development Environment
- Choosing Your JDK
- Installing JDK 26
- Selecting a Build Tool
- Installing Maven
- Creating Your First Project
- Running Your First Program
- Understanding the Project Structure
- The Master Project for This Book
- Summary
Chapter 2: How Java Works - Compilation and Execution
- From Source Code to Bytecode
- The Java Virtual Machine
- Class Files and the Classpath
- The Main Method
- Write Once, Run Anywhere
- Summary
Chapter 3: Language Fundamentals - Syntax, Types and Control Flow
- Variables and Primitive Types
- Strings and Immutability
- Operators and Expressions
- Control Flow Statements
- Arrays and Iteration
- Methods
- Summary
Chapter 4: Object-Oriented Programming in Java
- Classes and Objects
- Constructors and Initialization
- Encapsulation and Access Control
- Inheritance and Polymorphism
- Interfaces and Abstraction
- Abstract Classes vs. Interfaces
- Building the Library Management System Domain Model
- Summary
Chapter 5: Designing with Objects
- Cohesion and Coupling
- SOLID Principles in Java
- Composition Over Inheritance
- Immutability Patterns
- The Builder Pattern
- Common Design Mistakes
- Summary
Chapter 6: Packages, Modules and Project Organization
- Package Declaration and Naming
- Import Statements
- The Java Platform Module System
- Organizing a Maven Project
- Summary
Chapter 7: Exceptions and Error Handling
- Checked vs. Unchecked Exceptions
- Try-Catch-Finally Blocks
- Try-With-Resources
- Creating Custom Exceptions
- Exception Handling Best Practices
- Logging Errors Properly
- Summary
Chapter 8: Generics and Type Safety
- Why Generics Exist
- Generic Classes and Methods
- Type Parameters and Bounds
- Wildcards and the PECS Principle
- Type Erasure
- Common Generic Patterns
- Summary
Chapter 9: The Collections Framework
- Collection Interfaces Overview
- Lists in Practice
- Sets and Hashing
- Maps and Key-Value Storage
- Queues and Deques
- Collection Algorithms
- Summary
Chapter 10: Functional Programming with Lambdas and Streams
- Lambda Expressions
- Functional Interfaces
- Method References
- The Stream API
- Common Stream Patterns
- Performance Considerations
- Summary
Chapter 11: Modern Java Features - Records, Sealed Classes, Pattern Matching
- Record Classes
- Sealed Classes
- Pattern Matching for instanceof
- Switch Expressions and Pattern Matching
- Record Patterns
- Primitive Types in Patterns (Preview, Java 23+)
- Lazy Constants (Preview, Java 26)
- Text Blocks
- Version Compatibility
- Summary
Chapter 12: Annotations and Reflection
- Built-in Annotations
- Defining Custom Annotations
- Processing Annotations at Runtime
- Reflection Basics
- When to Use (and Avoid) Reflection
- Annotation Processors
- Summary
Chapter 13: Date, Time and Locale
- The Legacy Problem
- Core Classes
- Durations and Periods
- Time Zones
- Formatting and Parsing
- Common Pitfalls
- Summary
Chapter 14: File I/O, Networking and HTTP
- The NIO.2 File API
- Reading and Writing Streams
- JSON Processing
- HTTP Client
- Building a Simple HTTP Service
- Resource Management
- Summary
Chapter 15: Database Access
- JDBC Fundamentals
- Connection Pooling
- Parameterized Queries
- Transaction Management
- Introduction to JPA/Hibernate
- Entity Relationships and the N+1 Problem
- Testing Database Code
- Summary
Chapter 16: Concurrency Fundamentals
- Threads and Tasks
- Shared State and Race Conditions
- Synchronization
- Atomic Variables
- Thread Pools
- Concurrent Collections
- CompletableFuture: Composable Asynchronous Programming
- Summary
Chapter 17: Virtual Threads and Structured Concurrency
- The Platform Thread Problem
- Virtual Threads Explained
- Creating Virtual Threads
- When to Use Virtual Threads
- Thread Pinning
- Scoped Values
- Structured Concurrency
- Migration Strategies
- Applying Virtual Threads to the Library Management System
- Summary
Chapter 18: JVM Internals and Memory Management
- JVM Architecture Overview
- Class Loading: How the JVM Finds and Loads Classes
- Heap and Stack Memory
- Garbage Collection Fundamentals
- Tuning the JVM
- Memory Leaks in Java
- JVM Troubleshooting Guide
- Summary
Chapter 19: Testing Java Applications
- Test Types
- JUnit 5
- Mocking with Mockito
- Integration Testing with Testcontainers
- Property-Based Testing with jqwik
- Testing the Library Management System
- Test Coverage
- Summary
Chapter 20: Logging, Metrics and Observability
- Structured Logging
- Metrics Collection
- Distributed Tracing with OpenTelemetry
- Health Checks
- Alerting Strategies
- Integrating Observability into the Library Management System
- Summary
Chapter 21: Security in Java Applications
- Common Vulnerabilities: OWASP Top 10
- Input Validation
- Authentication and Authorization Basics
- Secure Configuration and Secret Management
- Cryptography APIs
- Summary
Chapter 22: Packaging, Deployment and Containerization
- Building JARs and Uber-JARs
- Native Images with GraalVM
- Dockerizing Java Applications
- JVM in Containers
- Deployment Patterns
- CI/CD Pipeline Example
- Summary
Chapter 23: Interoperability and Legacy Integration
- Calling Legacy Java Code
- Migrating from Older Java Versions
- Java and Other Languages
- XML Processing
- Serialization
- Maintaining Backward Compatibility
- Summary
Chapter 24: Production Readiness Checklist
- Code Quality Standards
- Performance Baselines
- Reliability Patterns
- Documentation Practices
- The Production Readiness Checklist
- Continuous Improvement
- Capstone: The Complete Production-Ready Library Management System
- Summary
Conclusion: Your Next Steps
- What You Have Built
- Where Java Is Heading
- Learning Resources
