Scanner is a simple text scanner which can parse primitive types and strings using regular expressions.
Source Code
Scanner scanner = new Scanner(System.in);
System.out.print("Enter your age: ");
int age = scanner.nextInt();
System.out.println("You are " + age + " years old.");