Valósítsa meg a hashCode() és az equals() metódust is.
public EqualsHashCode_Solution(String s){
super();
this .s = s;
}
public int hashCode(){
return s.hashCode();
}
public boolean equals( Object other ) {
return ( other instanceof EqualsHashCode_Solution ) &&
((EqualsHashCode_Solution)other).s.equals( s );
}
private String s = "";
|
|