import java.util.Scanner; Scanner keyboard = new Scanner(System.in); int number = keyboard.nextInt(); // next() for Strings, nextDouble() for doubles (etc for other types), nextLine() for whole line.