JAVA Need help with compareTo method public class Interval implements Comparable
ID: 3863443 • Letter: J
Question
JAVA
Need help with compareTo method
public class Interval implements Comparable<Interval> {
private final int begin;
private final int end;
public Interval(int begin, int end) {
this.begin = begin;
this.end = end;
}
// compare first by begin time, then by end time; see the examples below:
// (3, 7) < (4, 5) < (4, 6)
public int compareTo(Interval o) {
return 0;
}
public String toString() {
return "(" + begin + "," + end + ")";
}
}