Criselda Clave wrote: . . .
Collections.sort(words);
The Collections.sort() method will work "out of the can" on lists of various "basic" objects . . .
That is not really a helpful thing you have been told. It does not provide any explanation. Look at
this tutorial. Numbers and Strings are kinds of what some people call value objects. Not only do value objects represent a “value” but also (in many cases) they can be “equal to”, “more than” or “less than” each other. Now you find that means they have a “natural ordering”, so if you look at the documentation for String or all those types of Number mentioned, they all implement
Comparable. If you read that, you find those sort methods take Comparable as a parameter type.