Class Student completed.
This commit is contained in:
@@ -40,31 +40,20 @@ public class Student {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
// TODO:
|
||||
// Return custom hash
|
||||
|
||||
// Example:
|
||||
// return id % 97;
|
||||
|
||||
return 0;
|
||||
return this.getId() % 97;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) return false;
|
||||
|
||||
if (this == obj) return true;
|
||||
|
||||
// TODO:
|
||||
if (this.getClass() != obj.getClass()) return false;
|
||||
|
||||
// Step 1:
|
||||
// Check null
|
||||
Student other = (Student) obj;
|
||||
|
||||
// Step 2:
|
||||
// Convert obj to Student
|
||||
|
||||
// Step 3:
|
||||
// Compare IDs
|
||||
|
||||
return false;
|
||||
return this.id == other.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user