public static void main(String[] args) {


        HashMap myHashMap = new HashMap();


        //MyKey name argument passed is used for equals() and hashCode()
        MyKey key = new MyKey("Pankaj"); //assume hashCode=1234
        myHashMap.put(key, "Value");

// Below code will change the key hashCode() and equals()
// but it's location is not changed.
        key.setName("Amit"); //assume new hashCode=7890

//below will return null, because HashMap will try to look for key
//in the same index as it was stored but since key is mutated,
//there will be no match and it will return null.


        System.out.println(myHashMap.get(new MyKey("Pankaj")));
    }