-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* @ClassName Student | ||
* @Author: K | ||
* @create: 2019/9/10-20:38 | ||
**/ | ||
public class Student { | ||
String sn;//学号 | ||
String name; | ||
int age; | ||
int gender; | ||
|
||
@Override | ||
public boolean equals(Object o){ | ||
//如果o为null或者o与Card不是一个类型,直接返回false | ||
if(null == o || !(o instanceof Card)){ | ||
return false; | ||
} | ||
//如果o与this指向同一块区域返回true | ||
if(this == o){ | ||
return true; | ||
} | ||
return sn.equals(((Student) o).sn); | ||
} | ||
} |