This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
java:jfc_interfaces [2015/03/16 15:27] gthanos |
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; | ||
| } | } | ||
| | | ||