From 21df52a92087503e0817ac37bc4cac6c5c15e08c Mon Sep 17 00:00:00 2001 From: Tracy H Date: Mon, 4 Sep 2023 13:37:56 -0500 Subject: [PATCH 1/2] Change 'reader.nextLine()' to 'scanner.nextLine()'. --- data/part-1/3-reading-input.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/part-1/3-reading-input.md b/data/part-1/3-reading-input.md index 979f10289..7720fa070 100644 --- a/data/part-1/3-reading-input.md +++ b/data/part-1/3-reading-input.md @@ -270,7 +270,7 @@ NB! When using the `System.out.println` command, do not pass in the string "Ada ## Reading Strings -The `reader.nextLine();` command reads the user's input and *returns* a string. If we then want to use the string in the program, it must be saved to a string variable -- `String message = scanner.nextLine();`. A value saved to a variable can be used repeatedly. In the example below, the user input is printed twice. +The `scanner.nextLine();` command reads the user's input and *returns* a string. If we then want to use the string in the program, it must be saved to a string variable -- `String message = scanner.nextLine();`. A value saved to a variable can be used repeatedly. In the example below, the user input is printed twice. ```java //Introduce the Scanner tool used for reading From 974a55618f24ae419537bb7ac44561ff2c712331 Mon Sep 17 00:00:00 2001 From: Tracy H Date: Tue, 5 Sep 2023 13:27:11 -0500 Subject: [PATCH 2/2] Found another instance of 'reader.nextLine()' that doesn't belong. All other instances do belong. --- data/part-1/3-reading-input.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/part-1/3-reading-input.md b/data/part-1/3-reading-input.md index 7720fa070..26d1b6176 100644 --- a/data/part-1/3-reading-input.md +++ b/data/part-1/3-reading-input.md @@ -440,7 +440,7 @@ Hi Lily ## Program Execution Waits for Input -When the program's execution comes a statement that attempts to read input from the user (the command `reader.nextLine()`), the execution stops and waits. The execution continues only after the user has written some input and pressed enter. +When the program's execution comes a statement that attempts to read input from the user (the command `scanner.nextLine()`), the execution stops and waits. The execution continues only after the user has written some input and pressed enter. In the example below, the program prompts the user for three strings. First, the program prints `Write the first string: `, and then waits for user input. When the user writes some text, the program prints `Write the second string: `, and then waits for user input again. This continues for a third time, after which the program prints all three strings.