in Programming

Java arithmetic operators 

  • ​Arithmetic operators are used in mathematical expressions in the same way that they are used in algebraic equations.

+ addition

– subtraction

* multiplication

/ division

% modulo

+ operator

  • The + operator adds together two values, such as two constants, a constant and a variable, or a variable and a variable.

    int sum1 = 50 + 10;
    int sum2 = sum1 + 66;
    int sum3 = sum2 + sum2;

– subtraction

int sum1 = 1000 – 10;
int sum2 = sum1 – 5;
int sum3 = sum1 – sum2;

  • Related Content by Tag