public class OOP1 { public static void main(String[] args) { Student[] s = new Student[3]; s[0] = new Student("Dimmu",3.7); s[1] = new Student("Dani",3.6); s[2] = new Student("Shagrath",3.9); System.out.println("Max Student is "+Student.maxGPA(s)); } } class Student implements Comparable { private String name; private double gpa; public Student(String n,double g) { name = n; gpa = g; } public String toString() { return name+": "+gpa; } public int compareTo(Object s) { double diff = gpa - ((Student) s).gpa; if (diff < 0) return -1; else if (diff > 0) return 1; else return 0; } public static Student maxGPA(Student[] s) { Student max = s[0]; for (int c=1; c 0) max = s[c]; return max; } }