September 2019
Intermediate to advanced
816 pages
18h 47m
English
The first thing that comes to mind when sorting is the use of a comparator.
In this case, the solution should compare lengths of strings, and so the integers are returned by calling String.length() for each string in the given array. So, if the integers are sorted (ascending or descending), then the strings will be sorted.
The Java Arrays class already provides a sort() method that takes the array to sort and a comparator. In this case, Comparator<String> should do the job.