Java   View all facts   Glossary   Help
syntactic unit > symbol > operator > arithmetic operator
Next operatorassignment operator    Upoperator    Previous operator?:   

arithmetic operator comparison table
Subject use use in have example have syntax have purpose be is an instance of indicate
%an infix notation  
operand1 % operand2
to compute the remainder of dividing one operand by another  binary operatormodulus
*an infix notation  
operand1 * operand2
to multiply one operand by another  binary operatormultiplication
+an infix notation  
operand1 + operand2
to add two operands together or to perform string concatenationsaid to be an overloaded operator because it has two different meanings depending on the types of its operands
  • + indicates string concatenation
  • if its operands have type String
  • otherwise + indicates addition
binary operatoraddition
++ prefix or postfix form
example expressionequivalent longer expression
a++;
b=a++;
++a;
b=++a;
a=a+1;
b=a; a=a+1;
a=a+1;
a=a+1; b=a;
 to increment its operand by one unary operator 
-an infix notation  
operand1 - operand2
to subtract one operand from another  binary operatorsubtraction
-- prefix or postfix form
example expressionequivalent longer expression
a--;
b=a--;
--a;
b=--a;
a=a-1;
b=a; a=a-1;
a=a-1;
a=a-1; b=a;
 to decrement its operand by one unary operator 
/an infix notation  
operand1 / operand2
to divide one operand by another  binary operatordivision

Next operatorassignment operator    Upoperator    Previous operator?: