The Classic Guide to the Java Programming Language—Fully Updated through Java 21
Whatever version of Java you are using, Core Java, Volume I: Fundamentals, Thirteenth Edition, will help you achieve a deep and practical understanding of the language and APIs. With hundreds of realistic examples, Java Champion Cay S. Horstmann demonstrates the most powerful and effective ways to get the job done.
Written for experienced programmers looking for in-depth coverage of the Java language and platform, this revised and updated edition continues to be the first choice for serious programmers. The carefully crafted sample programs demonstrate almost every language and library feature, as well as the newest capabilities introduced in Java 21. The examples are purposefully simple to focus on the major points, but, for the most part, they aren't fake and they don't cut corners. They should make good starting points for your own code.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
【One-Line Pitch】
A rigorous, example-driven tour of the Java language and core APIs for programmers who already code in something else and want depth rather than hand-holding. If you need to understand *why* Java behaves the way it does—from `final` semantics to pattern matching in `switch`—this is the reference to keep within arm's reach.
【Book Arc】
- **Opening (~0%–10%)**: Orients you to the book's philosophy and the modern Java release cadence—six-month version cycles, preview features, and the long road to the module system—before any code appears.
- **Early (~10%–32%)**: Builds the language floor: comments and documentation conventions, constants and enumerated types, strings and `StringBuilder`, control flow, `BigInteger`/`BigDecimal`, arrays, and the `java.time` date API, then moves into writing real "workhorse" classes with fields, constructors, and methods.
- **Middle (~32%–55%)**: The object-oriented core—inheritance, method overriding, `Object` contracts (`equals`, `hashCode`, `toString`), wrapper classes and boxing, sealed/final class hierarchies, and the newer pattern-matching forms of `switch`.
- **Late (~55%–80%)**: Interfaces and their properties, comparison contracts (`Comparable`/`compareTo` across subclasses), reflection-based array access, and the collections and generics machinery that underpins everyday Java code.
- **Ending (~80%–100%)**: Consolidation around the standard library and practical packaging—JAR files, manifests, executable JARs, and deployment behaviors across operating systems. (Excerpts thin out here; exact closing chapters are not fully covered.)
【Key Takeaways】
- **Java's release model shapes how you learn it** (Opening): Since 2018, versions ship every six months and features may preview repeatedly—pattern matching for `switch` previewed four times before finalizing in Java 21. Knowing this explains why the book flags "preview" features separately.
- **Comments are three distinct tools, not one** (Early): Line, block, and `/**` documentation comments serve different purposes; block comments don't nest, so you can't reliably comment out code that already contains them.
- **`final` is Java's constant mechanism, not `const`** (Early): `const` is a reserved-but-unused keyword; constants are `static final`, and their visibility (class-level vs. local) is a deliberate design choice.
- **Enumerated types prevent invalid states** (Early): Encoding sizes as `1,2,3,4` or `S,M,L,X` invites errors; a proper `enum` restricts a variable to a finite set of named values.
- **Strings are Unicode sequences with real encoding subtleties** (Early): UTF-8 source files let you paste characters directly, while `StringBuilder` handles mutation, chaining, and reversal that `String` cannot.
- **`equals`, `hashCode`, and `toString` are contracts you must honor** (Middle): Overriding them correctly—often via `Objects.hash` and `super` calls—is essential for collections and debugging to behave sanely.
- **Wrapper classes are immutable, which limits them** (Middle): You cannot write a method that modifies a numeric parameter via `Integer`; boxing is convenient but not a substitute for mutable state.
- **Sealing a hierarchy encodes closed-world assumptions** (Middle): Marking subclasses `final` and using exhaustive `instanceof`/`switch` patterns documents that you know every variant—useful for fixed formats like JSON.
- **Interfaces are types, not classes** (Late): You can declare interface variables and test with `instanceof`, but never instantiate an interface; comparison logic across subclasses needs a deliberate `compareTo` strategy.
【Reading Tips】
- **Skim the opening history and acknowledgments** (~0%–10%) for context on Java's evolution, but don't linger—the value starts with the language chapters.
- **Deep-read the object contract sections** (`equals`/`hashCode`/`toString`, inheritance, interfaces). These are where experienced programmers most often carry over bad habits from other languages.
- **Treat API tables as reference, not prose.** The excerpted `BigInteger`, `LocalDate`, and `Integer` method listings are lookup material; read them once, then return as needed.
- **Watch the "Caution" and "C++ Note" callouts.** They flag genuine traps—non-nesting comments, manifest newlines, `finalize` misuse—that cost real debugging time.
- **Run the sample programs.** The book's examples are designed as starting points for your own code, so typing them out beats reading them passively.
【Coverage Limits】
This guide is synthesized from stratified excerpts covering roughly the first half of the book in detail, with the later sections (collections, generics, and deployment) represented only thinly. Chapter-level structure beyond the excerpted material is not asserted here.
Excerpt 1
(mtrail), Vladimir Ivanovic (PointBase), Jerry Jackson (CA Technologies), Heinz Kabutz (Java Specialists), Stepan V. Kalinin (I-Teco/Servionica LTD), Tim Kim...
eversed = new StringBuilder(original).reverse().toString(); Caution: Reversing works correctly for characters that are encoded with two char values, but it d...
va command, the javaw command doesn’t open a shell window.) On Mac OS X, the operating system recognizes the “.jar” file extension and executes the Java prog...
ult -> null; 15 }; 79 } 80 } 81 82 /** 83 * Prints all methods of a class 84 * @param cl a class 85 */ 86 public static void printMethods(Class cl) 87 { 88 M...
nstructor could have declared that it throws an IOException. In that case, you would not have known what kind of IOException it is; it could be a plain IOExc...
eChooser> to share a file chooser dialog. But it can’t work. After type erasure there is only one Singleton class, and only one singleInstance field. For tha...
n want to produce multiple threads with the same properties. The ThreadFactory interface has a single method Thread newThread(Runnable r) that produces a new...
zedList(List<E> c) static <E> Set synchronizedSet(Set<E> c) static <E> SortedSet synchronizedSortedSet(SortedSet<E> c) static <K, V> Map<K, V> synchronizedMa...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Core Java, Volume I (Cay S. Horstmann)(Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Core Java, Volume I (Cay S. Horstmann)(Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment