0% found this document useful (0 votes)
10 views

Operators in Java Programs (: Int X 9 + 5

The document discusses basic math, comparison, and assignment operators in Java including addition, subtraction, multiplication, division, modulo, increment, decrement, and assignment. Examples are provided for each operator type to demonstrate their usage.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Operators in Java Programs (: Int X 9 + 5

The document discusses basic math, comparison, and assignment operators in Java including addition, subtraction, multiplication, division, modulo, increment, decrement, and assignment. Examples are provided for each operator type to demonstrate their usage.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Operators in Java Programs (Basic Concept)

The Math Operators


A value used on either side of an operator is called an operand. For example,

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.

This is a example of Increment & Decrement

Explanation of Increment or decrement


The increment or decrement is operator provides a more convenient compact way ro decrease
or increase. The increment used (++) sign but the decrement used (--).
This is a example of prefix & postfix

Explanation of Prefix & postfix


The Prefix & postfix, my used both of increment and decrement operators. The prefix form, the
operator will appears before the operand. While the postfix will appears after operand.
Operators in Java Programs (Basic Concept)
Assignment Operators

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;

You might also like