mport java.util.Arrays; public class Demo { public static void main(String[] args){ /* int a[]={99,4,59,76,67,8}; Arrays.sort(a); for(int tmp:a){ System.out.print(tmp+" "); } */ double a[]={99.0,489.67,59.89,76.67,67.77,8.09}; Arrays.sort(a); System.out.print("Arrays.Sort排序结果: "); for(double tmp:a){ System.out.print(tmp+" "); } } }
Arrays.Sort排序结果: 8.09 59.89 67.77 76.67 99.0 489.67
注意:结果只能升序