public class Example { // violates the contract of equals - if two objects are // equals, their hashCode() method must return true. public boolean equals(Object that) { return true; } public static void main(String []av) { String s = "Hello"; // s is interned String v = "Hell" + o(); // v is not // v = v.intern(); // comparing references when should have compared via equals() if (s == v) { System.out.println(s + " == " + v); } else { System.out.println(s + " != " + v); } Example e1 = new Example(); Example e2 = new Example(); e1.equals(e2); } public static String o() { return "o"; } }