Expression = operands & operators

Operands are values, variables, numbers , quantities and operators are + , - , * , / , %.

Addition (+)

int friends = 10;
friends = friends + 1;
 
System.out.println(friends); // friends = 11

Subtraction (-)

int friends = 10;
friends = friends - 1;
 
System.out.println(friends); // friends = 9

Multiplication (*)

int friends = 10;
friends = friends * 2;
 
System.out.println(friends); // friends = 20

Division ( / )

int friends = 10;
friends = friends / 2;
 
System.out.println(friends); // friends = 5

NOTE

When we divide a number by an integer, if there is a remainder , our programme going to remove the remainder.

Example : 10/3 = 3 not 3.33333333

What if we need the decimal part? here is how to do that :

double friends = 10;
 
friends = friends /3;
System.out.println(friends); // 3.333333333

Modulus (%)

modulus gives u the remainder of division.

int friends = 10;
friends = friends % 3;
 
System.out.println(friends); // friends = 1

Shorthand to Arithmetics

Increment by 1

int friends = 10;
friends++;
 
System.out.println(friends); // friends = 11

Decrement by 1

int friends = 10;
friends--;
 
System.out.println(friends); // friends = 9