packageim;importjava.util.Arrays;publicclasstest{publicstaticvoidmain(String[]args){ testhello=newtest(); int[]scores={79,52,98,81}; System.out.println("共有"+hello.sort(scores)+"个成绩信息!"); } publicintsort(int[]scores){ Arrays.sort(scores); System.out.println(Arrays.toString(scores)); //返回数组中元素的个数returnscores.length; } } |