Java Program to Add Two Integers
In this example, we are giving a program to add two integer numbers.
To add two integer numbers:
# To print an Integer given by user
public class AddTwoIntegers {
public static void main(String[] args) {
int first = 10;
int second = 20;
int sum = first + second;
System.out.println("The sum is: " + sum);
}
}
Output:
Enter two numbers: 10 20 The sum is: 30