我有一个大小为10 ^ 6个元素的输入文件,我正在接受输入。
Input File:
100000 //size of the array
2 3 4 (so on as large as 10^6) 5 6 99
代码:
Scanner in = new Scanner(new FileReader("Input.txt"));
int n = in.nextInt();
int[] p = new int[n];
for(int j=0;j<n;j++)
p[j]=in.nextInt(); // line 90
错误:
Exception in thread "main" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at jobs.TestClass.main(TestClass.java:90)
请帮助我,我错了