JAVA · ОСНОВЫ · LESSON 10
User response
Scanner and input · about 17 minutes
Learning with progressRead the summary for free. To save the work, log in to the account.
Type the code yourself
Reprint the example. The code does not run on the site; try it later in VS Code.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String name = input.nextLine();
System.out.println("Привет, " + name);
input.close();
}
}Open the editor for class workSolve it yourself
Connect Scanner. In main, read one line in the color variable and output «Цвет: » along with color. At the end, close the Scanner.
The answer is hidden. Use similar examples from the lesson notes.
Opening up your homework