HashSet and mutations

Report a typo

Write the size of the given HashSet. Assume that hashCode() and equals() are overridden.

    Person james = new Person("James Gosling");

    Set<Person> set = new HashSet();
    set.add(james);
    set.add(new Person("James Gosling"));

    james.setName("J. Gosling");
    set.add(james);

    System.out.println(set.size());
Enter a number
___

Create a free account to access the full topic