Comments (1)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Mack
Level 20 , Osiedle-Nowiny, Poland
14 December 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.