Worked example
import java.util.Collections;
Collections.sort(names); // names is now sorted
System.out.println(names);
Numbers go in increasing order, strings alphabetically — the same order compareTo gives. Note the import: Collections lives in java.util like ArrayList.
Careful with the common mistake names = Collections.sort(names); — the method returns nothing, so this does not compile.