编程序,急用

求哪位大佬帮忙编一个程序,不要太小,要有注释,急用
天堂的蒲公英
浏览 1375回答 3
3回答

ziom

import java.util.Arrays; public class HelloWorld {          //完成 main 方法     public static void main(String[] args) {         HelloWorld hw = new HelloWorld();         int[] scores = {89, -23, 64, 91, 119, 52, 73};         hw.printTop3(scores);                  }          //定义方法完成成绩排序并输出前三名的功能     public void printTop3(int[] scores) {         Arrays.sort(scores);         int count = 0;         System.out.println("考试成绩的前三名为:");         // 注意:循环变量变化应为:i--         for (int i = scores.length-1; i >= 0; i--) {             if (scores[i] >= 0 && scores[i] <= 100) {                 count++;                 if (count > 3) break;                 System.out.println(scores[i]);             }         }     }      }求采纳

ziom

需求呢
打开App,查看更多内容
随时随地看视频慕课网APP