kak-otvet.imysite.ru/12308_kak_nayti_summu_dvuh_ch...
// Такой пример лучше.
import java.util.Scanner;
public class main_class {
public static void main(String[] args){
int sum = 0, firstNumber, secondNumber;
Scanner inputNumScanner = new Scanner(System.in);
System.out.println("Enter First Number: ");
firstNumber = inputNumScanner.nextInt();
System.out.println("Enter Second Number: ");
secondNumber = inputNumScanner.nextInt();
sum = firstNumber + secondNumber;
System.out.println("The sum of the two numbers you entered = " + sum);
}
}
/*
alex@alex:~/Consolejava/SprinklerSystem$ javac main_class
alex@alex:~/Consolejava/SprinklerSystem$ java main_class
Enter First Number:
4
Enter Second Number:
5
The sum of the two numbers you entered = 9
alex@alex:~/Consolejava/SprinklerSystem$
*/