Input and Output in Java — a practical guide to Java Scanner System.out with clear examples you can reuse in real projects.
Java Tutorial Series (14/90). Prefer one article? Read the complete Java tutorial.
Short description
`Scanner` is a simple way to read console input while learning. Close resources in larger apps.
Scanner I/O
import java.util.Scanner;
Scanner sc = new Scanner(System.in);
System.out.print("Name: ");
String name = sc.nextLine();
System.out.println("Hello, " + name);
sc.close();