This is some information on the Java 6 certification that I prepare. This information is not very well structured and it is most of the time an answer to the questions that come when I read the SCJP 6 book (Bates and Sierra). *** AS OF 5 OF MARCH 2010, I AM SCJP 6.0 ***

Friday, January 15, 2010

17 - Arrays.sort example - level basic - Java 1.6.0_17 - NB 6.8


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

Followers