This has nothing to do with generics.
And although it is possible to compare two different classes that one extends another, it is possible to do something even more twisted than that.
Kathy Sierra & Bert Bates - Chp 7 Generics and Collections p.576 wrote:We've talked a lot about sorting by natural order and using Comparators to sort.The last rule you'll need to burn in is that, whenever you want to sort an array
or a collection, the elements inside must all be mutually comparable. In other words, if you have an Object[] and you put Cat and Dog objects into it, you won't be able to sort it. In general, objects of different types should be considered NOT mutually comparable, unless specifically stated otherwise.
That means it's a bad idea to compare Cat and Dog, but you
could do it.
Here's an example of two totally different classes, mutually comparable:
Output is:
[Alexandre, Audi A3, Ford F-150, Glenn, Honda Fit, Michael, Sebastian, Wolkswagen Rabbit]
There you have it