Hier ist die Klasse: < /p>
Code: Select all
public class Student {
String name;
int marks;
public Student(String name, int marks) {
this.name = name;
this.marks = marks;
}
}
< /code>
Was ich bisher versucht habe: < /p>
List students = new ArrayList();
students.add(new Student("Alice", 85));
students.add(new Student("Bob", 95));
students.add(new Student("Charlie", 75));
// Attempt to sort
Collections.sort(students);