- import java.util.Arrays;
- public class Ch42
- {
- public static void main(String args[])
- {
- int n[]={34,65,7,-3,6546,-564,0,-11,90,123};
- System.out.println("排序前:");
- for(int i=0; i<n.length; i++)
- System.out.print(n[i]+" ");
- System.out.println();
- Arrays.sort(n);
- System.out.println("排序後:");
- for(int i=0; i<n.length; i++)
- System.out.print(n[i]+" ");
- }
- }
複製代碼 |