logo Practice-It logo

BJP5 Self-Check 6.12: readme1

Language/Type: Java file processing mystery Scanner
Author: Jared Jones (on 2019/09/19)

Consider a file called readme.txt that has the following contents:

6.7     This file has
        several input lines.

  10 20         30   40


What would be the output from the following code when it is run on the readme.txt file?

Scanner input = new Scanner(new File("readme.txt"));
int count = 0;
while (input.hasNextLine()) {
    System.out.println("input: " + input.nextLine());
System.out.println(count + " total");

You must log in before you can solve this problem.

Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.