Simple Java Maths
In this lesson, an introduction of the basic operators used in Java. For example, subtraction, addition, division, and multiplication are explained.
Introduction
Math in Java is very simple. Keep in mind that Java mathematical operations follow a particular order much the same as high school math.
For example, multiplication and division take precedence over addition and subtraction. The order in which these operations are evaluated can be changed using parentheses.
Operations in Java
The arithmetic operators in Java are listed below.
Symbols | Arithmetic operators |
---|---|
+ | add |
- | subtract |
/ | divide |
* | multiply |
% | modulus division |
++ | post and pre-increment |
-- | post and pre-decrement |
Get hands-on with 1300+ tech skills courses.