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:
parent
e44f9a4f70
commit
f23b71ec10
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user