If a class implements Comparable, we can call methods to allow us to say that one ___________ is less than, greater than, or equal to another. code example
Example: comparable interfacee
class Student implements Comparable<Student>{
int rollno;
String name;
int age;
Student(int rollno,String name,int age){
this.rollno=rollno;
this.name=name;
this.age=age;
}
public int compareTo(Student st){
if(age==st.age)
return 0;
else if(age>st.age)
return 1;
else
return -1;
}
}