Java Program to add two numbers

In this post, we will see how to add two numbers in java. This is the most basic program of java programming language.

Output:

Enter two numbers : 5 7
Sum of two numbers is 12

If you notice, we have use Scanner to take input from user.

Was this post helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *