Leanpub Header

Skip to main content

Modern Java Programming

From First Program to Production-Ready Systems with Java 26

This book is 100% completeLast updated on 2026-07-31

Ready to learn Java without getting lost in theory? Start with your first program, then work your way up to virtual threads, testing, observability and container deployment. With Java 26 and complete code that actually compiles, you’ll build the skills to create software fit for production.

Minimum price

$25.00

$39.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
398
Pages
About

About

About the Book

This book takes you from zero Java knowledge to advanced, production-ready proficiency using the latest Java release. You will install a complete development environment, master the language from syntax to virtual threads, build real applications with testing and observability, and learn how to deploy them in containers. Every code example is complete, idiomatic, and compiles exactly as written.

Bundle

Bundles that include this book

Author

About the Author

Steve Publications

Steve is a technology professional with more than 20 years of experience in software development, server infrastructure, cybersecurity, vulnerability research and reverse engineering. Throughout his career, he has designed, secured, analyzed and tested complex software and infrastructure, with a particular focus on understanding how systems fail and how they can be made more secure.

Outside of work, Steve enjoys sharing knowledge with the technology community. He collaborates with researchers, industry experts and technology professionals to write practical books covering software development, cybersecurity, cloud computing, networking, DevOps, artificial intelligence and enterprise technologies. His books focus on practical learning through clear explanations, real-world examples and hands-on exercises. With more than two decades of industry experience, his goal is to help IT professionals, students and technology enthusiasts build useful skills and stay current in a rapidly changing industry.

We believe readers deserve to know how our books are created. Most of our authors are not native English speakers, so we use AI to help translate, proofread manuscripts, fix grammar, improve sentence structure and make technical explanations easier to read. AI is used as an editing tool only. It does not replace the research, technical knowledge or hands-on experience behind our books. Some of our authors also prefer to remain anonymous for privacy or professional reasons. In those cases, we publish their work under a different name. The author's name may be different, but the quality of the content and our review process remain the same.

Every book is written, reviewed and maintained by experienced technology professionals, with contributions from our private technical community of more than 420 engineers and researchers from Ukraine, Belarus and Russia. We spend far more time validating technical accuracy and keeping our content up to date than generating text. We are always interested in working with experienced professionals who have deep expertise in a particular technology or domain. If you would like to publish a book with us or help review an existing manuscript, we'd love to hear from you. Send us a message describing your area of expertise. We are especially interested in niche technologies, specialized skills and emerging topics that are underrepresented in existing technical literature.

If you look through the contents of our books, you'll see practical examples, detailed explanations and material that is regularly updated. Our goal is to publish books that professionals can actually rely on, not low-effort AI-generated content. If you ever feel that one of our books does not meet that standard, Leanpub offers a 60-day money-back guarantee. Feel free to request a refund if you are not satisfied with your purchase.

Contents

Table of Contents

From First Program to Production-Ready Systems with Java 26

Introduction: Why Java Still Matters

  1. The Numbers That Tell the Story
  2. From Applets to Virtual Threads
  3. What This Book Covers (and Doesn’t)
  4. Your First Milestone
  5. Versions Used in This Book

Chapter 1: Setting Up Your Java Development Environment

  1. Choosing Your JDK
  2. Installing JDK 26
  3. Selecting a Build Tool
  4. Installing Maven
  5. Creating Your First Project
  6. Running Your First Program
  7. Understanding the Project Structure
  8. The Master Project for This Book
  9. Summary

Chapter 2: How Java Works - Compilation and Execution

  1. From Source Code to Bytecode
  2. The Java Virtual Machine
  3. Class Files and the Classpath
  4. The Main Method
  5. Write Once, Run Anywhere
  6. Summary

Chapter 3: Language Fundamentals - Syntax, Types, and Control Flow

  1. Variables and Primitive Types
  2. Strings and Immutability
  3. Operators and Expressions
  4. Control Flow Statements
  5. Arrays and Iteration
  6. Methods
  7. Summary

Chapter 4: Object-Oriented Programming in Java

  1. Classes and Objects
  2. Constructors and Initialization
  3. Encapsulation and Access Control
  4. Inheritance and Polymorphism
  5. Interfaces and Abstraction
  6. Abstract Classes vs. Interfaces
  7. Building the Library Management System Domain Model
  8. Summary

Chapter 5: Designing with Objects

  1. Cohesion and Coupling
  2. SOLID Principles in Java
  3. Composition Over Inheritance
  4. Immutability Patterns
  5. The Builder Pattern
  6. Common Design Mistakes
  7. Summary

Chapter 6: Packages, Modules, and Project Organization

  1. Package Declaration and Naming
  2. Import Statements
  3. The Java Platform Module System
  4. Organizing a Maven Project
  5. Summary

Chapter 7: Exceptions and Error Handling

  1. Checked vs. Unchecked Exceptions
  2. Try-Catch-Finally Blocks
  3. Try-With-Resources
  4. Creating Custom Exceptions
  5. Exception Handling Best Practices
  6. Logging Errors Properly
  7. Summary

Chapter 8: Generics and Type Safety

  1. Why Generics Exist
  2. Generic Classes and Methods
  3. Type Parameters and Bounds
  4. Wildcards and the PECS Principle
  5. Type Erasure
  6. Common Generic Patterns
  7. Summary

Chapter 9: The Collections Framework

  1. Collection Interfaces Overview
  2. Lists in Practice
  3. Sets and Hashing
  4. Maps and Key-Value Storage
  5. Queues and Deques
  6. Collection Algorithms
  7. Summary

Chapter 10: Functional Programming with Lambdas and Streams

  1. Lambda Expressions
  2. Functional Interfaces
  3. Method References
  4. The Stream API
  5. Common Stream Patterns
  6. Performance Considerations
  7. Summary

Chapter 11: Modern Java Features - Records, Sealed Classes, Pattern Matching

  1. Record Classes
  2. Sealed Classes
  3. Pattern Matching for instanceof
  4. Switch Expressions and Pattern Matching
  5. Record Patterns
  6. Primitive Types in Patterns (Preview, Java 23+)
  7. Lazy Constants (Preview, Java 26)
  8. Text Blocks
  9. Version Compatibility
  10. Summary

Chapter 12: Annotations and Reflection

  1. Built-in Annotations
  2. Defining Custom Annotations
  3. Processing Annotations at Runtime
  4. Reflection Basics
  5. When to Use (and Avoid) Reflection
  6. Annotation Processors
  7. Summary

Chapter 13: Date, Time, and Locale

  1. The Legacy Problem
  2. Core Classes
  3. Durations and Periods
  4. Time Zones
  5. Formatting and Parsing
  6. Common Pitfalls
  7. Summary

Chapter 14: File I/O, Networking, and HTTP

  1. The NIO.2 File API
  2. Reading and Writing Streams
  3. JSON Processing
  4. HTTP Client
  5. Building a Simple HTTP Service
  6. Resource Management
  7. Summary

Chapter 15: Database Access

  1. JDBC Fundamentals
  2. Connection Pooling
  3. Parameterized Queries
  4. Transaction Management
  5. Introduction to JPA/Hibernate
  6. Entity Relationships and the N+1 Problem
  7. Testing Database Code
  8. Summary

Chapter 16: Concurrency Fundamentals

  1. Threads and Tasks
  2. Shared State and Race Conditions
  3. Synchronization
  4. Atomic Variables
  5. Thread Pools
  6. Concurrent Collections
  7. CompletableFuture: Composable Asynchronous Programming
  8. Summary

Chapter 17: Virtual Threads and Structured Concurrency

  1. The Platform Thread Problem
  2. Virtual Threads Explained
  3. Creating Virtual Threads
  4. When to Use Virtual Threads
  5. Thread Pinning
  6. Scoped Values
  7. Structured Concurrency
  8. Migration Strategies
  9. Applying Virtual Threads to the Library Management System
  10. Summary

Chapter 18: JVM Internals and Memory Management

  1. JVM Architecture Overview
  2. Class Loading: How the JVM Finds and Loads Classes
  3. Heap and Stack Memory
  4. Garbage Collection Fundamentals
  5. Tuning the JVM
  6. Memory Leaks in Java
  7. JVM Troubleshooting Guide
  8. Summary

Chapter 19: Testing Java Applications

  1. Test Types
  2. JUnit 5
  3. Mocking with Mockito
  4. Integration Testing with Testcontainers
  5. Property-Based Testing with jqwik
  6. Testing the Library Management System
  7. Test Coverage
  8. Summary

Chapter 20: Logging, Metrics, and Observability

  1. Structured Logging
  2. Metrics Collection
  3. Distributed Tracing with OpenTelemetry
  4. Health Checks
  5. Alerting Strategies
  6. Integrating Observability into the Library Management System
  7. Summary

Chapter 21: Security in Java Applications

  1. Common Vulnerabilities: OWASP Top 10
  2. Input Validation
  3. Authentication and Authorization Basics
  4. Secure Configuration and Secret Management
  5. Cryptography APIs
  6. Summary

Chapter 22: Packaging, Deployment, and Containerization

  1. Building JARs and Uber-JARs
  2. Native Images with GraalVM
  3. Dockerizing Java Applications
  4. JVM in Containers
  5. Deployment Patterns
  6. CI/CD Pipeline Example
  7. Summary

Chapter 23: Interoperability and Legacy Integration

  1. Calling Legacy Java Code
  2. Migrating from Older Java Versions
  3. Java and Other Languages
  4. XML Processing
  5. Serialization
  6. Maintaining Backward Compatibility
  7. Summary

Chapter 24: Production Readiness Checklist

  1. Code Quality Standards
  2. Performance Baselines
  3. Reliability Patterns
  4. Documentation Practices
  5. The Production Readiness Checklist
  6. Continuous Improvement
  7. Capstone: The Complete Production-Ready Library Management System
  8. Summary

Conclusion: Your Next Steps

  1. What You Have Built
  2. Where Java Is Heading
  3. Learning Resources

Glossary

References

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub