← Skill tree CS Skill Tree 0 CSCD210

Classes, Encapsulation, and the equals/hashCode Pair

Textbook: BJP (Reges and Stepp) Ch 8

Where you are: Week 0 review > Classes, encapsulation, and equals/hashCode

This part of the review is three short lessons. Work them in order:

  1. Writing a class: private fields, a validating constructor, getters and setters, and toString.
  2. References: arrows, ==, and aliasing: a reference is an arrow to an object, and what == compares.
  3. equals and hashCode: comparing contents, and why the two methods must be overridden together.

Finish all three before moving on to Comparable, composition, and Comparator, the bridge into CSCD 211.


Resources

Canonical: BJP (Reges and Stepp) §8.1-8.4 (classes and encapsulation), §9 (Object methods); Liang 10e §9 (Objects and Classes), §10 (Object-Oriented Thinking). Section numbers are grounded from the published tables of contents; exact page numbers depend on the printing and are pending a faculty spot-check.

Show 3 more resources
  • Java SE 25 API: java.lang.Object.equals and hashCode.
  • Practice: code.jdoner.me CSCD 210 classes and equals exercises (coding practice and tracing).
  • Video (URL pending verification): equals and hashCode in Java.