Java guides
Every published Java guide, newest first, with practical examples you can copy into your own project.
3,965 guides across 14 topics
Topics
Popular Java guides
Most readLatest Java guides
Page 4 of 109Java Iterator vs Stream: Choosing the Right Traversal API
Compare Java's Iterator and Stream APIs to decide which fits your traversal needs, considering state, laziness, performance, checked exceptions, and code clarity.
Java Iterator vs For-Each: When to Use Which
Compare the Java Iterator interface with the for-each loop: syntax, element removal, fail-fast behavior, performance, and when to choose each approach.
Java Set vs Map: When to Use Each Collection
Java Set and Map are both collection interfaces, but they solve different problems. Learn how each stores data, common implementations like HashSet and HashMap, and when to use which collection.
Java Aggregation vs Composition: Ownership and Lifecycle
Understand the practical difference between aggregation and composition in Java, including lifecycle ownership, implementation, and design guidance.
Java Composition vs Inheritance: How to Choose
Compare Java composition and inheritance with concrete examples, tradeoffs, and decision criteria to build maintainable class designs.
Java static final vs final: Key Differences
Understand how static final and final differ in Java: where values live, how assignment works, compile-time inlining, memory footprint, and concurrency guarantees.
Java Overriding vs Method Hiding: Key Differences
Understand the difference between overriding instance methods and hiding static methods in Java, including runtime behavior, compile-time resolution, rules, and examples.
Java Interface vs Abstract Class: How to Choose
A practical guide to choosing between Java interfaces and abstract classes, covering state, constructors, multiple inheritance, default methods, and API evolution.
Java final vs finally vs finalize
java final vs finally vs finalize: Understand the distinct roles of final, finally, and finalize in Java, including syntax, usage, and why finalize is deprecated.
Java equals vs compareTo: Key Differences and When to Use Each
Understand the difference between equals() and compareTo() in Java, including their contracts, consistency requirements, and when to implement each correctly.