java.util. Arrays.sort(scores);
2024-10-19 22:20:31
import java.util.*;
public class ArraySortScore { //完成 main 方法
public static void main(String[] args) { int counter=0;
int[] scores=new int[]{89 , -23 , 64 , 91 , 119 , 52 , 73};
SortScore(scores);
int index=0;
while(index<scores.length)
{
System.out.println(scores[index]);
index+=1;
}
System.out.println("考试成绩的前三名为:");
index=0;
while(index<scores.length)
{
if(scores[index]>=0 && scores[index]<=100)
{
System.out.println(scores[index]);
counter+=1;
if(counter==3)
break;
}
index+=1;
} } //定义方法完成成绩排序并输出前三名的功能
public static void SortScore(int[] scores)
{
Arrays.sort(scores);
} }
---------- java ----------
-23
52
64
73
89
91
119
考试成绩的前三名为:
52
64
73 Output completed (0 sec consumed) - Normal Termination
最新文章
- 控制台查看原生sql
- scanf、printf、gets、puts的应用及区别
- jQuery 自定义扩展,与$冲突处理
- [转]SVN的trunk branch tag
- PHP超级全局变量总结
- webapp 微信开发适配问题
- LINUX下的远端主机登入 校园网络注册 网络数据包转发和捕获
- 金融&;业务常识积累
- 【BZOJ2037】Sue的小球(动态规划)
- vue 中使用promise
- windows最简单的局部截图工具
- Gym - 101848B Almost AP 暴力
- http协议、web服务器、并发服务器(下)
- 使用 OpenSSL 创建私有 CA:3 用户证书
- JS之事件机制
- js实现双向链表
- [CF587F]Duff is Mad[AC自动机+根号分治+分块]
- html图片链接不显示图片
- mysql只读模式的设置方法与实验【转】
- PHP----练习-----三级联动