Correction:

public class MyClass1 {
  private final int value;

  public MyClass1(int value) {
      this.value = value;
  }

  public static int hashCode(MyClass1 obj) {
      return 3 * obj.value;
  }

  public static void main(String... args) {
      MyClass1 c = new MyClass1(99);
      System.out.println(c.hashCode());
      System.out.println(hashCode(c));
System.out.println(Object.hashCode(c)); // compile error if using official version of class Object
  }
}


-Ulf


Reply via email to