For adding numbers of same type we have to first define the variables. Like in below code we define two variables of type **int. **

int i=5;
int j=10;
int sum = i + j;
System.out.println(sum);

For adding numbers which have different types; int i=5; float j=10;

float sum = i + j;
System.out.println(sum);

**Sum** variable type should be in float (data type)

### Related Posts