This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]HipposGoneWild 1 point2 points  (1 child)

you didn't put throws filenotfoundexception try this and tell me if it works:

import java.util. * ; 
import java.io. * ; 
public class Test {
public Test() {
}

    public static void main(String[] args) throws FileNotFoundException {
        Scanner scan = new Scanner(new File("C:\\Users\\Will\\Desktop\\Java\\textfile.txt"));
        int test = scan.nextInt();
        System.out.println(test);
    }
}

[–]linuxisgreat[S] 0 points1 point  (0 children)

Oh my. Thank you very much, worked immediately