import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Student{
     int id;
     String name;
    Student(int id,String name){
        this.id=id;
        this.name=name;
    }
    public String toString(){
        return id+" "+name;
    }
}
class NameComparable implements Comparator<Student>{
    public int compare(Student s1,Student s2){
        return s1.name.compareTo(s2.name);
    }
}
class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
        List<Student> list=new ArrayList<>();
        list.add(new Student(1,"ksuuma"));
        list.add(new Student(3,"bhaskari"));
        list.add(new Student(2,"satyanarayana"));
        Collections.sort(list,new NameComparable());
        System.out.println(list);
        
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: