java compareto jdei stackoverflow

Solutions on MaxInterview for java compareto jdei stackoverflow by the best coders in the world

showing results for - "java compareto jdei stackoverflow"
Samuel
19 Nov 2020
1public int compareTo(Jedi jedi){
2    int result = this.name.compareTo(jedi.getName());
3    if(result == 0){
4        result = this.age > jedi.age ? 1 : this.age < jedi.age ? -1 : 0;
5    }
6    return result;
7}
8