第1个回答 2012-02-27
public class StudyObject{
public static void main(String[] args){
int[] i = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
Scanner scan=new Scanner(System.in);
System.out.println("请选择范围1~19的整数");
int qq=scan.nextInt();
try{
for (int j = 0; j < i.length; j++) {
if(i[j]<=qq){
System.out.println(i[j]);
}
}
}catch(Exception e){
System.out.println("您输入的范围格式不对,请重新输入");
}
}
}随便测试,绝对坚固不报error