public class Test
{
public static void main(String[] args) throws FileNotFoundException
{
Scanner input = new Scanner("text.txt");
int x = input.nextInt();
}
}
的text.txt感:为什么会抛出InputMismatchException?
8
8
6
7
此代码抛出一个InputMismatch
异常。为什么?
该死的我觉得自己像个白痴。谢谢! – Qwertywasd
我认为你的意思是“文件”。 :) – Zong
不:)我的意思是数字。我应该说:*'text.txt'是一个不包含数字的字符串。* –