The Big Three in Java, Part Three: hashCode()

For part three in this series of four blog posts, we look at another one of Java’s “big three” methods: Object.hashCode(). This method returns an integer value that can be used to split objects into buckets. One critical requirement is that any two objects that compare as equal must return the same hash code. We explore how to meet that requirement, while also writing hashCode() methods that are effective and efficient.

The Big Three in Java, Part Two: equals(Object)

In the second of a series of four blog posts, we explore another one of the “big three” methods in Java: the Object.equals(Object) method. This method allows us to compare two objects of a given type for value equality, instead of just reference equality. That is, this method can compare the internal state of two objects to determine if they’re equal.

The Big Three in Java, Part One: toString()

In the first of a series of four blog posts, we’ll explore one of the “big three” methods in Java: the Object.toString() method. This method generates a String representation of an object and its state. By overriding the Object.toString() method in any class that we write, we can customize, for example, how objects of that class are displayed when printed to the console.

Things I Wish I Had Known: Learning C++ After Learning Java

When I learned to program, I learned in Java. When I started studying my second language, C++, I found myself struggling to understand the subtle differences in syntax, the significant differences in how memory management works, and even the differences in the meaning of some terms between Java and C++. This blog post lays out three things I wish had realized right off the bat when I started learning C++.

ChatGPT Fails an Introductory Computability Question

Using generative AI, like ChatGPT, comes with a significant risk: the AI can be very confident in its answers, while also being very wrong. In this blog post, we’ll examine a finite state machine (FSM) question about even and odd numbers. ChatGPT will attempt to solve it, then we’ll discuss where and how it went wrong. We’ll also lay the groundwork for a correct solution to the problem.