Scanner Class is used to take input from user.
import java.util.Scanner;
Scanner input = new Scanner(System.in); // Reading from System.in
System.out.println("Enter a first number: ");
int n = input.nextInt(); // Scans the next token of the input as an int
//once finished
input.close();