The Scanner class reads input from the keyboard (or other sources). You create one by passing System.in:
Scanner scanner = new Scanner(System.in);
System.out.print("Enter your name: ");
String name = scanner.nextLine();
System.out.print("Enter your age: ");
int age = scanner.nextInt();
nextLine() reads the entire line as a String. nextInt() reads the next token and parses it as an int. There are similar methods for double, boolean, and other types.
Since Scanner implements AutoCloseable, you can use it with try-with-resources. But when reading from System.in, closing the scanner also closes System.in, which means you cannot read input again later in the same program. Keep that in mind.