How to use the arithmetic operators?
The following example show you how to use Java arithmetic operators. The operators consist of the multiplicative operators (
* for multiplication,
/ for division),
% for remainder of division) and the additive operators (
+ for addition,
- for substraction).
You'll also see we are using a combination of a simple assignment operator with the arithmetic operators to create compound assignments.