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

Merge pull request #782 from Fuge2015/master

fix a bug: compareTo implement.
This commit is contained in:
SnailClimb 2020-05-18 09:44:32 +08:00 committed by GitHub
commit 12fd03e771
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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