0

I didn't understand the hashtag and equals() method..help me guys

14th Jun 2018, 1:25 PM
Coding Niffler
Coding Niffler - avatar
6 Answers
+ 4
hashtag is not a method from java >> hashcode() Java.lang.object has two very important methods: public boolean equals(Object obj) and public int hashCode(). equals() method is used to compare equality of two Objects. equals() must be reflexive, symmetric, transitive and consistent. consistent :if the objects are not modified, then it must returning the same value Furthermore, object.equals(null) must always return false. hashCode() must also be consistent and returns the hashcode value as an Integer. consistence: if the object is not modified in terms of equals(), it must keep returning the same value The relation between the two methods is: Whenever a.equals(b), then a.hashCode() must be same as b.hashCode(). If you override the equals(), then you should override the hashcode() method and use the same set of fields from the object that you use to implement equals() and hashCode(). look at this https://dzone.com/articles/working-with-hashcode-and-equals-in-java https://www.geeksforgeeks.org/equals-hashcode-methods-java/
14th Jun 2018, 8:51 PM
asa22
+ 3
Which language?
14th Jun 2018, 1:28 PM
Just A Rather Ridiculously Long Username
+ 3
Its alright, but I think you should edit the question and add the tag so that the people who know the answer can find your question.
14th Jun 2018, 1:35 PM
Just A Rather Ridiculously Long Username
0
java ...sry forgot to mention it
14th Jun 2018, 1:29 PM
Coding Niffler
Coding Niffler - avatar
0
ok thanks
14th Jun 2018, 1:35 PM
Coding Niffler
Coding Niffler - avatar
0
thanks for your help asa22
16th Jun 2018, 7:39 AM
Coding Niffler
Coding Niffler - avatar