package com.imooc;import java.util.Arrays;//引入Arrays类public class Grade { public static void main(String[] arags){ int[]grades={89,-23,64,91,119,52,73}; Grade grade=new Grade();grade.compare(grades);}public void compare(int[]Arrays1){ int j=0; int[]Arrays2={0}; for(int i=0;i<Arrays1.length;i++){ while(Arrays1[i]>=1&&Arrays1[i]<=100){ Arrays2[j++]=Arrays1[i]; } } Arrays.sort(Arrays2); for(int k=0;k<3;k++){ System.out.println("考试成绩前三名为:"+Arrays2[k]); }}}
添加回答
举报
0/150
提交
取消