返回列表 發帖
  1. import java.util.Arrays;

  2. public class Ch02 {
  3.         public static void main(String args[]) {
  4.                 int n[] = { 34, 65, 7, -3, 6546, -564, 0, -11, 90, 123 };
  5.                 System.out.println("排序前:");
  6.                 for (int i = 0; i < n.length; i++) {
  7.                         System.out.print(n[i] + " ");
  8.                 }
  9.                 System.out.println();
  10.                 Arrays.sort(n);
  11.                 System.out.println("排序後:");
  12.                 for (int i = 0; i < n.length; i++) {
  13.                         System.out.print(n[i] + " ");
  14.                 }
  15.         }
  16. }
複製代碼

TOP

返回列表