/* * COSC 1010 Demo #2 * Adds together two numbers. * @author Dennis Brylow * @version 1.01,   2010 Sep 03 */ import java.util.Scanner; public class Adder { public static void main(String[] args) { // Polite programs prompt their users for input. System.out.println("Please enter two numbers: "); // Setup a Scanner object to read from the user. Scanner keyboard = new Scanner(System.in); int x = 0, y = 0; // Read in two integers. x = keyboard.nextInt(); y = keyboard.nextInt(); // Calculate and print the sum. System.out.println("The sum of " + x + " and " + y + " is " + (x + y) + "."); } }