Add Two Number Program In Java- Java Program Example

Java Program To Add Two Number Show After Add.   In This Post We Learn A Java Program To Add Two Integer Number.


Program Code 

package com.androidpro.in;

import
java.io.BufferedReader;
import
java.io.IOException;
import
java.io.InputStreamReader;
import
java.io.PrintStream;
import
java.util.Scanner;

public class
Main {

   
public static void main(String args[])
    {
       
int x, y, z;

       
System.out.println("Enter two integers to calculate their sum ");
       
Scanner in = new Scanner(System.in);

       
x = in.nextInt();
       
y = in.nextInt();
       
z = x + y;
       
System.out.println("Sum of entered integers = "+z);
   
}

}


Output

Enter two integers to calculate their sum

98

98

Sum of entered integers = 196

 

Process finished with exit code 0