Write a  Java Program to Add Two Integers

Java Program to Add Two Integers

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn Java programming concepts. You can learn Java  language at your own speed and time. One can learn concepts of Java language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Java Program to Add Two Integers
Java Program to Add Two Integers

Write a  Java Program to Add Two Integers

PROGRAM: Java Program to Add Two Integers

/* Java Program to Add Two Integers */

class Main {

public static void main(String[] args) {

int first = 10;
int second = 20;

// add two numbers
int sum = first + second;
System.out.println(first + ” + ” + second + ” = ” + sum);
}
}

OUTPUT:-  30

Note:– Output changes with the change of int first , int second values.

Leave a Reply

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