Ask coding questions

← Back to all posts
How do I run the File class?
saverenjunrenju (0)

Okay so this is the question I have: Given the file below, what is the output?
in.dat
1 2 3 4 5

Scanner scan = new Scanner(new File("in.dat"));

while(scan.hasNext())

System.out.print(scan.next());

Even if I knew the answer, how would I test to see to run if it's true?