Lecture 22
7
Equality
•In Java, “==” means “two variables have same value”
•Box and arrow pictures help:
–same value for primitive types is just what you expect
–same value for reference types: arrow points to the same Object
•In Object
–public boolean equals(Object o) {
–   return this == o;
–}
•Override equals when you have a better idea about what equality should mean