public class CorrectHashCode { private int number; public CorrectHashCode(int i) { number=i; }
public int hashCode() { int i=(int)(Math.random()*100); return i*number;//以该过 } //other methods }答案:the code does not implement hashCode() method correctly对不起是我笔误,但改过来以后还是有错,这是一道scjp的考题 我不是很明白
{
private int number;
public CorrectHashCode(int i)
{
number=i;
}
public int hashCode()
{
int i=(int)(Math.random()*100);
return i*number;//以该过
}
//other methods
}答案:the code does not implement hashCode() method correctly对不起是我笔误,但改过来以后还是有错,这是一道scjp的考题
我不是很明白