i want to sort by name : this code i used for sort int values.But now i want to sort Strings.This is my code.
        
    public class Comparable5 {
            public static void main(String[] args) {
                TreeSet ts=new TreeSet();
                ts.add(new Student1(2,"Thilan"));
                ts.add(new Student1(1,"Kamal"));
                ts.add(new Student1(3,"Nimal"));
                
                System.out.println(ts);
            }
        }
        class Student1 implements Comparable<Student>{
            int id;
            String name;
            public Student1(int id,String name){
               this.id=id;
                       this.name=name; 
            }
        
            
        
            @Override
            public String toString() {
             return this.id+":"+this.name;
            }
        
            @Override
            public int compareTo(Student o) {
                if (o.name.equals(this.name)) {
                    return -1;
                } else if(o.name.equals(this.name)){
                        return +1;
                }
                else{
                    return 0;
                }
            }
            
        }

i'm trying to sort names using Comparable Interface.In here i used equals method.But i unable to do sorting.in here i had used a constructor that has two parameter.I have already done sorting ids.but i'm unable to do that to names(String).how i sort Strings using compareTo method in Comparable interface.
