Java Arrays.sort(char[] a)
Syntax
Arrays.sort(char[] a) has the following syntax.
public static void sort(char[] a)
Example
In the following code shows how to use Arrays.sort(char[] a) method.
/*w w w .j a v a2 s .c o m*/
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
char cArr[] = {'j','a','v','a'};
System.out.println(Arrays.toString(cArr));
// sorting array
Arrays.sort(cArr);
System.out.println(Arrays.toString(cArr));
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »