Operators on Integers in Java Programming

Operators on Integers in Java Programming

Previous Home Next

 

Operators on Integers in Java Programming are the arithmetic operators,assignment operators, relational operators,logical and bit wise operators almost every operator is used on integers in java.

Addition ,subtraction,division,multiplication,modulus,relational operations all are used on integers in java.
Addition, as you would expect, is accomplished using the plus sign (+) operator. The form of an addition operation is

operand + operand
 
// Add two literal values
int result = 5 + 5;

// Add two variables
int a = 5;
int b = 6;
int result = a + b;

// Add two variables and a literal
int result = a + b + 15;


 
// Add two literal values
int result = 5 + 5;

// Add two variables
int a = 5;
int b = 6;
int result = a + b;

// Add two variables and a literal
int result = a + b + 15;

Previous Home Next