For instance:
class A{
    public int a;
    public String b;
    public A(int a, String b){
        this.a = a;
        this.b = b;
    }
}
main(){
    List<A> list = new Arraylist<>();
    list.add(new A(5, "abc"));
    list.add(new A(1, "aee"));
    list.add(new A(3, "adf"));
    list.add(new A(6, "aad"));
    list.add(new A(2, "xx"));
}
Is there any way to sort this list in ascending order using the integer in A class. I've already tried
Collection.sort(list) but getting some syntax error. What I'm doing wrong.
 
     
     
     
    