i am trying to read the input of integers such as
17
100
19
18
on a .txt file, but i always get a FileNotFoundException. It will output the result
0000
if i run the code below:
import java.io.File;
import java.io.FileNotFoundException;
import java.util.*;
public class umm {
public static void main(String[] args) throws FileNotFoundException {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(new File("huhu.txt"));
int [] tall = new int [100];
int i = 0;
while(scanner.hasNextInt())
{
tall[i++] = scanner.nextInt();
System.out.print(tall[i]);
}
scanner.close();
}
}
if i add the integers in the .txt file so that it will have 6 integers like this
17
100
19
18
2
5
it will output
000000
doesn't this mean that the file exists and it can access it? but why does it keep saying FileNotFound?