equals and hashcode method are present in the Object class and are inherited into the class that we define. Well in the object class equals() method gives out the same answer as == i.e if the references point to the same object then they are equal. hashcode() will give different hashcodes for different objects everytime putting them in different buckets.
Actually equals method should compare the values in the objects and then give the result. As for Wrapper and
String classes the equals method is implemented and thus will give the comparison between the object values.
well same goes for hashcode(). If you implement the hashcode() according to you need so that the objects go in a specific bucket rather than each object getting its own bucket. there is no harm in getting its own bucket but it will allow duplicates to get different buckets thus using up the space. If hashcode() method is implemented then you can minimize the adding of duplicates in different buckets.