interface - Rate is not abstract and does not override abstract method compareTo(java.lang.Object) in java.lang.Comparable -
I'm getting an error telling me that I'm not implementing the comparative method when I'm. My code looks like this (I leave the accelerator method because they are OK):
applies the public class rate Comparative {Private Entity Month; Private int de; Private int year; Private double rate; Private int a; Private int b Private int c; Private int d; // Constructor method for class mass rate (int month, int day, int verte, double rate 0) {month = month; Day = day 0; Year = year 0; Rate = rate 0; } Compare the public difference (rate obj) // @ the absolute obj rate object that will be compared to other rate objects {A = (int) rate - (visceral) obj.getRate (); B = year - obj.getYear (); C = months - obj.getMonth (); D = day - obj.getDay (); If (a! = 0) comes back; // @ Return the difference between the rate for one of two objects if (b! = 0) b returns; // @ Renton B. If the difference between the two items for the year (C! = 0) return C; // @ Return C If the difference between months for two items (D! = 0) return D; // @Ruran D. The differences between days for the two items and return 0; // @ 0 layer if two objects are completely identical. }}
change this:
public class Comparative to apply rate
This:
applies the public class rate Comparative < Rate & gt;
Ensure that you override equals and hash loads, and that your equal method gives the same behavior as comparison, when two values are the same, if you do not, then you are subtle, Bugs will experience.
Comments
Post a Comment