Commenti (1)
  • Popolari
  • Nuovi
  • Vecchi
Devi avere effettuato l'accesso per lasciare un commento
Mack
Livello 20 , Osiedle-Nowiny, Poland
14 dicembre 2018, 22:15
How did you do task 1714 "Comparable" ? I have problem with method ComareTo().. @Override public synchronized int compareTo(Beach o) { float f = Float.compare(this.distance, o.distance); int i = Integer.compare(quality, o.quality); return (f==0 && i==0)? 0 : 1; } Validator: The Beach class's compareTo method should at least account for beach quality and distance. Be sure that x.compareTo(y) == -y.compareTo(x) Be sure that compareTo returns different values for different objects.