您的位置:首页 > 编程语言

第七章编程题

2018-01-06 10:18 162 查看
7.

/*Input.java*/
package test;

import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Input {

public static void main(String[] args) {
int i=0;
int[] j=new int[10];
Scanner input=new Scanner(System.in);
while(i<10)
{
int s;
try {System.out.println("输入数据:");
s=input.nextInt();
if(s>1){
j[i]=s;
i++;
}
else
throw(new IOException());
} catch (IOException e) {
System.out.println("输入错误!");
continue;
}
}
System.out.println(Arrays.toString(j));
Arrays.sort(j);
System.out.println("max:"+j[j.length-1]);
System.out.println("min:"+j[0]);
}
}
8.throws TimedOutException
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  java异常