1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

fix a bug: compareTo implement.

This commit is contained in:
dongfu 2020-05-17 09:29:53 +08:00
parent e44f9a4f70
commit f23b71ec10

View File

@ -384,10 +384,11 @@ public class Person implements Comparable<Person> {
// TODO Auto-generated method stub // TODO Auto-generated method stub
if (this.age > o.getAge()) { if (this.age > o.getAge()) {
return 1; return 1;
} else if (this.age < o.getAge()) { }
if (this.age < o.getAge()) {
return -1; return -1;
} }
return age; return 0;
} }
} }