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.
equals()
Collapse
X
-
You are in luck.Originally posted by kirthu4uWrite 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.
There's an article in the Java articles section which explains all that you have described above ... and more.
Comment