class Sock { String size; String color; public boolean equals(Object o) { Sock s = (Sock) o; return color.equals(s.color); } // insert code here } 哪两个满足 hashCode 的约定?()
A. public int hashCode() { return 343; }
B. public int hashCode() { return size.hashCode (); }
C. public int hashCode() { return color.hashCode (); }
D. public int hashCode() { return (int) (Math.random() * 1000);