我在Windows 8编码的Java上Textpad当程序运行,并在用户输入他们的意见,只要用户输入他的输入,它说麻烦与Textpad
读取用户输入中断!工具已完成,退出代码为130.
无法找出问题并需要帮助。
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class userinput {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private int rollno;
private String name;
public void get() throws IOException, NumberFormatException {
System.out.print("Enter the rollno :");
rollno = Integer.parseInt(br.readLine());
System.out.print("Enter the name :");
name = br.readLine();
}
public static void main(String args[]) {
userinput a = new userinput();
try {
a.get();
} catch (IOException e) {
System.out.println("Invalid Entry");
} catch (NumberFormatException f) {
System.out.println("Invalid entry");
}
}
}
您的问题似乎并没有与您的代码相关,因为它工作正常。如果可能的话,使用IntelliJ,Eclipse或Netbeans等更好的开发环境,或者在Textpad中正确读取用户输入的内容做一些研究,因为它似乎有点不同。 – Tom