Simple Addition in Java Program

Java is one of the most popular programming languages for beginners. If you are just starting, learning simple addition is the best way to understand variables, data types, and basic syntax.
In this blog, you’ll learn how to perform addition in Java with easy code examples.

Here is the basic Java program to add two numbers:

public class Addition {
public static void main(String[] args)

{
int a = 10;
int b = 20;
int sum = a + b;

System.out.println(“Sum = ” + sum);
}
}

Output:

Sum = 30
 

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

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