Lessons

Java tutorial

Java Operators

Operators calculate a new value. + - * / and % are the everyday arithmetic operators. When both numbers are ints, division keeps only the whole-number part.

Example

Edit the code and run it again. This runner stays in your browser and covers the syntax used in these lessons.

Output

Run the example to see output here.

What this code does

The five lines are the sum, difference, product, whole-number quotient, and remainder of 8 and 3. The remainder operator is %.