class person implements Comparable { public String name; public int compareTo(person x) {return name.compareTo(x.name);} } class student extends person implements Comparable { public double gpa; // boring stuff skipped // How is the compareTo method be inherited? } //class Sorter> // older form class Sorter> // since jdk 1.8 { void bubblesort(T[] A) // bubble sorts (pointer to) array A { for(int i=0;i0) { T tmp = A[k]; A[k]=A[k+1]; A[k+1]=tmp; //swap }// not efficient but that's not the point here }//bubblesort static void notreallymain() { Sorter S = new Sorter(); //compiles with ? super T //Sorter S = new Sorter(); //classes never covariant } } // what if I try to do a super on a return type? -- following won't compile /* interface D { T f(); } class DD implements D { public person f() { return null; } } class CC> { static void stillnotmain() { CC x = new CC(); } } */