what is code for adding two integers in java

what is code for adding two integers in java

Grade:12th Pass

3 Answers

qwertykey key
14 Points
9 years ago

hey its very simple

you need to use the + operator for adding nos in java


int a=9;

int b=1;

int s=a+b;


the output will be 10

say thanks to qwertykey;for more help reply me on askiitians forum

bhaveen kumar
38 Points
9 years ago

a = 5;

b = 10;

c = a + b;

System.out.println("The sum is " + c);

Aravind Bommera
36 Points
9 years ago
import java.util.Scanner;
class AddNumbers
public static void main(String args[])
int x, y, z;
System.out.println("Enter two integers to calculate their sum ");
Scanner in = new Scanner(;
x = in.nextInt();
y = in.nextInt();
z = x + y;
System.out.println("Sum of entered integers = "+z);

Think You Can Provide A Better Answer ?