use*_*151 4 exception-handling ioexception java-7 numberformatexception
我试图在命令提示符中运行以下简单代码最近几个小时.仍然无法修复错误.
这里有什么问题.我找不到.
这是代码:
public static void main(String[] args) {
int i;
try {
DataInputStream din = new DataInputStream(System.in);
i = Integer.parseInt(din.readLine());
}
catch(NumberFormatException || IOException exception) {
System.out.println(exception.getMessage());
}
}
Run Code Online (Sandbox Code Playgroud)
Gok*_* KP 10
需要使用单一|操作员.没有||.
catch(NumberFormatException | IOException exception)
Run Code Online (Sandbox Code Playgroud)