└── sort.txt /sort.txt: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | public class SortArrayExample1 3 | { 4 | public static void main(String[] args) 5 | { 6 | //defining an array of integer type 7 | int [] array = new int [] {90, 23, 5, 109, 12, 22, 67, 34}; 8 | //invoking sort() method of the Arrays class 9 | Arrays.sort(array); 10 | System.out.println("Elements of array sorted in ascending order: "); 11 | //prints array using the for loop 12 | for (int i = 0; i < array.length; i++) 13 | { 14 | System.out.println(array[i]); 15 | } 16 | } 17 | } --------------------------------------------------------------------------------