Whenever I override hashcode() using eclipse 'source' menu it generates following code in the class
final int prime = 31;
int result = 1;
result = prime * result + ((fieldName1== null) ? 0 : fieldName1.hashCode());
result = prime * result + ((fieldName2== null) ? 0 : fieldName2.hashCode());
Could anyone please explain why it is doing all this calculation(multiplication and then addition), why it is not returning simply
fieldName.hashCode();
or
fieldName2.hashCode();
?