Connecting Tech Pros Worldwide Forums | Help | Site Map

equals()

Newbie
 
Join Date: Nov 2007
Posts: 2
#1: Nov 27 '07
Write a simple base class with at least two attributes and associated setter and getter methods. Define an equals() for this base class. Ensure that your equals() method satisfies the equals contract. Next write a simple class that extends your base class and which has at least one new attribute with associated setters and getters. Write an equals() method for this new class. Ensure that this satisfies the equals contract.

Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#2: Nov 27 '07

re: equals()


Quote:

Originally Posted by kirthu4u

Write a simple base class with at least two attributes and associated setter and getter methods. Define an equals() for this base class. Ensure that your equals() method satisfies the equals contract. Next write a simple class that extends your base class and which has at least one new attribute with associated setters and getters. Write an equals() method for this new class. Ensure that this satisfies the equals contract.

You are in luck.
There's an article in the Java articles section which explains all that you have described above ... and more.
Reply