I\'m trying to get the hang of Java. Unit testing is pretty important to me and so recently I\'ve started to use JUnit. It was tough to begin with but I\'m getting the hang
If you are using a modern IDE for development (like Eclipse, IntelliJ etc), they can generate these methods for you. Check that out for two reasons: 1) to save time 2) To prevent possible bugs.
In eclipse IDE, you can do so by selecting source -> generate hashCode() and equals().
One more thing, when you implement of of these two, you have to implement the other one as well.