String[] arr = new String[] {"asa","fda","ds","sxc","casdf"}; Arrays.sort(arr); for (int i = 0; i < arr.length; i++) { System.out.println(arr[i]); }