AP Computer Science

(objRef1 = = objRef2) compares the references, not the objects themselves. In Java, we write/use the equals() method when we want to compare the contents of two objects of the same class. Most Java classes will have an equals() method. When you write a new class, you should consider whether you should write an equals() method for it. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download