This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
java:jfc_interfaces [2016/02/26 11:15] 127.0.0.1 external edit |
java:jfc_interfaces [2017/05/12 13:20] (current) gthanos |
||
---|---|---|---|
Line 51: | Line 51: | ||
public int getId() { | public int getId() { | ||
return id; | return id; | ||
+ | } | ||
+ | | ||
+ | public boolean equals(Object obj) { | ||
+ | if(!(obj instanceof Student) ) | ||
+ | return false; | ||
+ | Student st = (Student)obj; | ||
+ | if( id == id && firstName.equals(st.firstName) && lastName.equals(st.lastName) ) | ||
+ | return true; | ||
+ | return false; | ||
} | } | ||
| |