Skip to content
Snippets Groups Projects
Commit 6691db5b authored by Ethan Robert's avatar Ethan Robert
Browse files

Minor changes to Person

parent cea3173f
No related branches found
No related tags found
No related merge requests found
package tp04;
public class Person { public class Person {
private int ID; final private int ID;
private String forename; private String forename;
private String name; private String name;
private static int counter; private static int counter;
public Person(String name, String forename) { public Person(String forename, String name) {
this.forename = forename; this.forename = forename;
this.name = name; this.name = name;
...@@ -39,8 +41,12 @@ public class Person { ...@@ -39,8 +41,12 @@ public class Person {
} }
public boolean equals(Object other) { public boolean equals(Object other) {
if (other == null) {
return false;
}
if (other.getClass() == this.getClass()) { if (other.getClass() == this.getClass()) {
return other.ID == this.ID; Person otherPerson = (Person) other;
return otherPerson.getID() == this.ID;
} }
return false; return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment