There are many way to add two numbers in Java. You can use add two numbers using bufferedreader, scanner, functions, methods and command line arguments. However, you can use the same program in IDE’s such as netbeans and Eclipse. The given below takes the user input to add two numbers. However it’s a simple program which uses Scanner method.
Here is the program :
public class addition
public static void main(String args)
Scanner sc = new Scanner ( System.in);
System.out.println(“Enter first number :”);
System.out.println(“Enter second number :”);
System.out.println(“The addition is :” +c);
The above program has been executed successfully. If you are unable to get the output that means you typed it wrong or did some mistake after copy pasting.
Execute the program and enter the numbers to be added to get the addition of the numbers.