Implement an interface : I'm studying implement an interface and abstract class and here it comes to this question that I'm struggling with. I hope you guys can help me out with this question and I'm looking for an explanation in order to understand the code. Any advice is welcome and truly appreciate.

I have been trying to run the code to get the output but it does not work.I think C is an answer but I'm not sure.

Here is the question: Which of the following will order an array of Student objects by last name, then by credits (if two students have the same last name) if you were to pass the array of Students to the Arrays.sort() method?

```java
Student[] list;
// The array is created and filled with Student objects...
Arrays.sort(list);
A. public class Student implements Comparable {
    private String lastName;
    private int credits;
 
   public int compareTo(Student s) {
        int result = lastName.compareTo( s.getLastName() );
        if (result != 0)
            return result;
        else
            return credits - s.getCredits();
    }
}
B. public class Student implements Comparable {
    private String lastName;
    private int credits;
 
   public int compareTo(Object o) {
        int result = credits - ( ((Student) o).getCredits() );
        if (result != 0)
            return result;
        else
            return lastName.compareTo( ((Student) o).getLastName() );
    }
}
C. public class Student {
    private String lastName;
    private int credits;
 
   public int compareTo(Object o) {
        result = lastName.compareTo( ((Student) o).getLastName() );
        if (result != 0)
            return result;
        else
            return credits - ( ((Student) o).getCredits() );
    }
}
D. public class Student implements Comparable {
    private String lastName;
    private int credits;
 
   public int compareTo(Object o) {
        int result = lastName.compareTo( ((Student) o).getLastName() );
        if (result != 0)
            return result;
        else
            return credits - ( ((Student) o).getCredits() );
    }
}
```