最赞回答 / 濑津美
int[] scores = { 89, 72, 64, 58, 93 };Arrays.sort(scores); int c=0;//c为数组该元素的下标 for (int score : scores) { System.out.println("scores["+c+"]="+score); c++; }
2019-05-20
最新回答 / 一叶丶孤舟
continue 是结束本次循环跳入下一次循环,循环不结束;break是跳出当前循环,循环结束。在你的if判断中是输入前三名就结束循环,不然继续遍历数组输出。写程序每个人思路不同,自然用的结束语句也不同,程序没毛病。
2019-05-17