JAVA: Program to Add Two Integers



public class AddTwoIntegers {

    public static void main(String[] args) {
        
        int first = 10;
        int second = 20;

        System.out.println("Enter two numbers: " + first + " " + second);
        int sum = first + second;

        System.out.println("The sum is: " + sum);
    }
}

When you run the program, the output will be:

Enter two numbers: 10 20
The sum is: 30

Comments