The Future Is Behind You

Sort an Array

Fill an array with letters and then sort it.

import java.util.Arrays;

public class SortArray {
  public static void main(String[] args) {
    String[] myArray = {"z", "a", "x", "b"};
    Arrays.sort(myArray);
    Arrays.stream(myArray)
      .forEach(System.out::println);
  }
}

Output:

a
b
x
z

Source Code

a = b = c