Addition is one of the four primary arithmetic operations. The operator + (plus) operates on two operands to produce the sum.
sum = operand1 + operand2;
sum: variable. Allowed data types: int, float, double, byte, short, long.operand1: variable or constant. Allowed data types: int, float, double, byte, short, long.operand2: variable or constant. Allowed data types: int, float, double, byte, short, long. int a = 5;
int b = 10;
int c = 0;
c = a + b; // the variable 'c' gets a value of 15 after this statement is executed
float a = 5.5;
float b = 6.6;
int c = 0;
c = a + b; // the variable 'c' stores a value of 12 only as opposed to the expected sum of 12.1