public static void main(String[] args) {
// reverse order
char[] array1 = {'f', 'e', 'd', 'c', 'b', 'a'};
for (char cs : array1) {
System.out.println(cs);
}
Arrays.sort(array1);
for (char cs : array1) {
System.out.println(cs);
}
}
run:
f
e
d
c
b
a
a
b
c
d
e
f
No comments:
Post a Comment