Core APIs
The JDK's core classes are the workhorses of daily Java development.
Object,String,Math, the wrapper types, andOptionalappear in almost every codebase. Getting fluent with their contracts — especiallyequals/hashCodeandOptional's anti-patterns — prevents a category of bugs that are otherwise hard to trace.
What You'll Find Here
| Topic | Description |
|---|---|
| Object Class | equals, hashCode, toString, clone, wait/notify — the root contract every Java object must honour. |
| String, StringBuilder, StringJoiner | Text processing APIs — immutability, pool, efficient building, and delimited joining. |
| Math & StrictMath | abs, pow, floor, overflow-safe arithmetic methods, and cross-platform reproducibility. |
| Wrapper Classes | Integer, Long, Double; parseInt, caching gotcha with ==, and autoboxing NPE traps. |
| Optional (Java 8+) | Nullable-value container; proper use patterns and common anti-patterns to avoid. |
Learning Path
- Object Class — the
equals/hashCodecontract is foundational; violating it breaks collections. - String & StringBuilder — understand immutability and when to use
StringBuilderover+; includesStringJoinerand text blocks. - Wrapper Classes — focus on the
Integer.valueOf(-128..127)caching trap and its==implication; autoboxing NPE pitfalls. - Math & StrictMath — overflow-safe arithmetic with
addExact/toIntExact; rounding modes and trigonometry conventions. - Optional — learn what it solves, then learn what it does NOT solve (never use as a field or parameter).
Related Domains
- Core Java — introduces
Stringand primitive types. - Collections Framework —
equals/hashCodefromObjectgovernsHashMapandHashSetbehavior. - Java Type System — wrapper classes interact with autoboxing.