I want my class to implement the Comparable interface. Which of the following approaches is correct
Option 1:
public Myclass implements Comparable<MyClass>{
public int compareTo(MyClass o){
//impl here
}
}
Option 2:
public Myclass implements Comparable{
public int compareTo(Object o){
//check if o instance of my class
//impl here
}
}