//The following line is needed to get a number from the keyboard. import java.util.Scanner; public class Input { public static void main(String[] args) { System.out.print("Please click in the Console, "); System.out.print("type a number, and press ENTER: "); int i = getInt(); //Get a number from the keyboard. System.out.print("Type another number, and press ENTER: "); int j = getInt(); System.out.println("The sum is " + (i + j) + "."); } //The following 8 lines are needed to get an integer from the keyboard. private static int getInt() { final Scanner scanner = new Scanner(System.in); if (scanner.hasNextInt()) { return scanner.nextInt(); } System.err.println("Expected an integer."); return 0; } }