Scanner in = new Scanner("datafile.txt") //wrong way

//RIGHT WAY
File file = new File("datafile.txt");
Scanner in = new Scanner(file);

I hope that helps if the rest of your code is right