星期六, 5月 21, 2005

Lab Object Variables

Study Display 5.9 and then write a program such that
1. an object variable aObject of class ToyClass holds the content of ("Mrs. Smith",1)
2. another object variable bObject of class ToyClass also holds the content of ("Mrs. Smith",1)
3. the other object variable cObject that have the same reference as aObject
4. Test whether aObject == bObject, meaning the two have the same reference.
5. Test whether aObject.equals(bOject), meaning the two hold the same content.
6. Test whether aObject == cObject
7. Test whether aObject.equals(cOject)