Student[] feld = { new Student("Meier","Peter",122), new Student("Meier","Andrea",142), new Student("Brandt","Uwe",12), new Student("Meyer","Jens",121), new Student("Schulz","Jasmine",11), new Student("Schulz","Jürgen",14), new Student("Beyer","Ute",17) }; ComparatorStudent comp = new ComparatorStudent(); MergeSortGeneric mergeSort = new MergeSortGeneric(); Student[] feldNeu= (Student[]) mergeSort.sort(feld, comp); System.out.println("Ausgabe"); for (Student value: feldNeu) { System.out.println(" "+value); } import java.util.Comparator; public class ComparatorStudent implements Comparator { @Override public int compare(Student a, Student b) { return a.compareTo(b); } } public class Student implements Comparable{ public String lastname=""; public String firstname=""; public int mnr=0; public Student(String lastname,String firstname, int mnr) { this.lastname=lastname; this.firstname=firstname; this.mnr=mnr; } @Override public String toString(){ return lastname+", "+firstname+", "+mnr; } @Override public int compareTo(Student std) { int result =lastname.compareTo(std.lastname); if (result==0) { result =firstname.compareTo(std.firstname); } return result; } }