public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int[] a=new int[10];//定义一个数组
//给数组的10个元素赋值
for (int i = 0; i < a.length; i++) {
System.out.println("请输入第"+(i+1)+"个值:");
a[i]=input.nextInt();
}
Arrays.sort(a);//排序,默认从小到大排序
System.out.println("数组的最大值:"+a[a.length-1]);
}
标签:10,int,最大值,System,键盘输入,数组,input
From: https://www.cnblogs.com/jiahaozhang/p/16818899.html