scanner through system.in java code example
Example 1: java read string input
import java.util.Scanner;
public class YourClass {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String inputString = scanner.nextLine();
System.out.println("Your string: " + inputString);
}
}
Example 2: how to create a Scanner Object in java
Scanner console = new Scanner(System.in);