In other words, this class is used to initialize your store as soon as the application is started. The role of this class in your Shopping Cart Application is to provide you with the store products. Why do I need to Override equals and hashCode method in Java?.Therefore, it is very important to override hascode() and equals() method of an object.įollowing is a very well explained answer that tells you the importance of overriding hashcode and equals for object comparison. If both (hash code & properties value) are same then the object is considered equal otherwise not equal. Their hash code and properties are compared. hashCode()is a unique hash/number attached to every object whenever the object is created.equals()method is used to compare two objects based on their properties. ![]() I have also override the Hash and Equals method. This is a concrete class which contains Product properties and provides setters and getters for it. I will take each class one by one and explain the significance of it. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |