输入两个数字的加法程序然后显示它们的和。
import java.util.Scanner; public class Main { /**来自 n o w j a v a . c o m**/ // main method begins execution of Java application public static void main(String[] args) { // create a Scanner to obtain input from the command window Scanner input = new Scanner(System.in); int number1; // first number to add int number2; // second number to add int sum; // sum of number1 and number2 System.out.print("Enter first integer: "); // prompt number1 = input.nextInt(); // read first number from user System.out.print("Enter second integer: "); // prompt number2 = input.nextInt(); // read second number from user /* *来 自 N o w J a v a . c o m - 时 代 J