Hello everybody, I am having an issue with the role beyond compareTo(). I create a Student class that implements the Comparable interface. The following is the sample of code :
but whenCode:class Student implements comparable {<Student> private String name; private int age; // Constructor // Setters and Getters public int compareTo (Student E) { return name.compareTo (E.get Name ());}// this method does work and throws compilation error
public int compareTo (Student E) {
return Age.compareTo (E.getAge it gives me an error ());}
Thank you
Bookmarks