String [] stringArrays = {"bledar", "nik", "george", "calem", "2"};
//Unsorted Array
for (String strin : stringArrays) {
System.out.println(strin);
}
//Sort array
Arrays.sort(stringArrays);
for (String strin : stringArrays) {
System.out.println(strin);
}
//reverse order
Arrays.sort(stringArrays, Collections.reverseOrder());
//index sorting
Arrays.sort(stringArray, 2, 8);
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.