KNOW:
BE ABLE TO:
Sample Exam Question:
A Student class is defined as follows:
class Student{ String name; int id; String address; ... }and the equals() method for Student is defined as
boolean equals(Object o){ if ( o instanceof Student) return this.name.equals(((Student)o).name) && this.id == ((Student)o).id; else return false; }Define a hashCode() method for the Student class that is compatible with the given equals() method.