posted 14 years ago
[code]
public class TestHash {
private int length;
private int width;
private final double area;
public TestHash (int l, int w)
{
length = l;
width = w;
area = length * width;
}
}
[code]
from this example, I learnt a final variable and a variable changeble by two variables should be involved in hashcode manipulation, what about for equals?
it makes sense for me to use it for equals, for example,
final integer for area, of shapes, can be used to compare so is one of the methods to find out if they are equal objects.
am i right?! :roll:
[ November 13, 2007: Message edited by: adam Lui ]