SortArray1.java
Select all
/* SortArray1.java David G. Klick 2/1/06 CIS 260 This program demonstrates the built-in sort method of the Arrays utility class to sort an array of objects that implement the Comparator interface. */ import java.util.*; public class SortArray1 { public static void main(String[] args) { Integer[] n = { new Integer(8), new Integer(-8), new Integer(13), new Integer(7), new Integer(42), new Integer(5) }; Arrays.sort(n); for (Integer i : n) System.out.print(i + " "); } }