The two lines that do it
import java.util.Scanner; // at the very top of the file
Scanner in = new Scanner(System.in); // once, at the start of main
int n = in.nextInt(); // read one whole number
Treat these as a recipe for now — you will learn exactly how they work later. What matters today: after in.nextInt() the value from the Input box is stored in n, and you use n like any other variable.
For text use in.next(); to read two numbers, call in.nextInt() twice.