import java.util.*; public class Sortimine{ public static void main(String[] arg){ String[] eesnimed={"Juku", "Madis", "Kati", "Anu", "Mati"}; Arrays.sort(eesnimed); System.out.println(Arrays.toString(eesnimed)); Arrays.sort(eesnimed, (e1, e2) -> e1.length()-e2.length()); System.out.println(Arrays.toString(eesnimed)); //Sorteerige nimed viimase tähe järgi Arrays.sort(eesnimed, (e1, e2) -> e1.substring(e1.length()-1). compareTo(e2.substring(e2.length()-1))); System.out.println(Arrays.toString(eesnimed)); } }