Skip to main content

Core APIs

The JDK's core classes are the workhorses of daily Java development. Object, String, Math, the wrapper types, and Optional appear in almost every codebase. Getting fluent with their contracts — especially equals/hashCode and Optional's anti-patterns — prevents a category of bugs that are otherwise hard to trace.

What You'll Find Here

TopicDescription
Object Classequals, hashCode, toString, clone, wait/notify — the root contract every Java object must honour.
String, StringBuilder, StringJoinerText processing APIs — immutability, pool, efficient building, and delimited joining.
Math & StrictMathabs, pow, floor, overflow-safe arithmetic methods, and cross-platform reproducibility.
Wrapper ClassesInteger, 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

  1. Object Class — the equals/hashCode contract is foundational; violating it breaks collections.
  2. String & StringBuilder — understand immutability and when to use StringBuilder over +; includes StringJoiner and text blocks.
  3. Wrapper Classes — focus on the Integer.valueOf(-128..127) caching trap and its == implication; autoboxing NPE pitfalls.
  4. Math & StrictMath — overflow-safe arithmetic with addExact/toIntExact; rounding modes and trigonometry conventions.
  5. Optional — learn what it solves, then learn what it does NOT solve (never use as a field or parameter).