Operators in Java Programs (: Int X 9 + 5
Operators in Java Programs (: Int X 9 + 5
int x = 9 + 5;.
Java has 5 arithmetic operators; it is
(+) addition
(-) subtraction
(*) multiplication
(/) division
(%) modulo
This are the example of a addition & subtraction
Explanation of addition;
The (+) sign operator adds together two values each, such two constant, a constant and a
variable. A coomonly used math operation on variables is to a set of variable its own value plus
another value
Explanation of subtraction
The dash (-) operator stracts one value to another. The (–) operator will replace a two values
with difference between the two values, just like with the (+) operator.
Operators in Java Programs (Basic Concept)
The example of Multiplication, Division, Modulo
Explanation of Multiplication:
The asterisk (*) operator of multiplies two(2) values. Multiplying a variable with a value &
assigning the value back to the variable is a common math operators in java applications.
Explanation of Division
The forward slash (/) operator to divides one value to another. This can be dividing one constant
with another. You can chain multiple for division, but because of java math operator
precedence.
Explanation of modulo:
The modulo or remainder (%) math operation performs an integers or whole numbers of division
of one value by another and returns the remained of that division.
The assignment operator (=) which assign a value to a variable. Int value=5 Java provides a
number of assignment operators to make it code easier. The assign the value of 5 to a variable
to value type of int.
The example of addition,subtraction & assignment;