解决方案 »
- java 题目 完成两个数组内容的交换 并输出
- 请高手救急!!! 有关ConvolveOp及Kernel的实现,愿以5本图书相赠。
- 图片加载类(GUI)
- c/s结构,Swing和socket的传输的问题和加载图片能够点击动态执行的问题(在线等)
- 如何从一个配置文件读取相关参数?
- HttpConnection 的连接等待问题(急!)
- 在jbuilder5中编译实现rmi远程接口方法时的错误,请指出
- 在linux下可否用 VC?在linux下如何可以用Java吗?能做哪些事情?
- 用什么JAVA软件可能建立和打开*.class文件?最好是小软件。哪里有下载?
- 编写一个Flash播放器
- 为什么我把javacompiler从1.4给为1.7就报错(hashmap的错)?
- jdbc 链接mysql 数据库 求帮忙 急!!!!!!
int a=0;
try{ a=scan.nextInt();}catch(RuntimeException e){ e.printStackTrace
}
...这样你后面代码就可以执行了,不过如果出现数据类型不匹配异常(NumberFormatException)那么a就为初始值0.
public class Test {
public static void main(String[] args) throws Exception { while(true) {
try {
Scanner s = new Scanner(System.in);
int i = Integer.valueOf(s.nextLine());
System.err.println(i);
} catch (Exception e) {
System.err.println("cause: " + e.getMessage());
}
} }
}
if(str==null||"".equals(str)){
return false;
}
for(char the:str.toCharArray()){
if(the<'0'||the>'9')
return false;
}
return true;
}