-
Notifications
You must be signed in to change notification settings - Fork 0
Java Operators
Adrian Patterson edited this page Nov 23, 2021
·
2 revisions
- An operator (like in math) is used to modify a stored value
- E.g. consider two integers stored in memory, that we want to add. We would first declare the integers, and then use the + operator to perform addition
int x = 5; int y = 10; int sum = 0; sum = x + y;
- The addition of x and y is stored in the variable sum
- Java has many operators. The most important ones we will explore are:
- Addition +
- Subtraction -
- Multiplication *
- Division /
- Assignment =
- Function Call .
- E.g. consider two integers stored in memory, that we want to add. We would first declare the integers, and then use the + operator to perform addition