Suspicious line

Report a typo

Look at the code below:

String pathToFile = "file.txt";
try (Scanner scanner = new Scanner(new File(pathToFile))) {
    scanner.nextLine();
    scanner.nextLine();
    System.out.println(scanner.nextLine());
}

Our file file.txt contains just 2 lines:

first
second

What does the code print in a console in this case?

Hint: to find the right answer you may run this piece of code on your computer and check the result.

Select one option from the list
___

Create a free account to access the full topic