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

Java Operators: Jayson Angelo E. Vale Cruz

Operators are symbols that perform logical or mathematical functions on operands. There are unary operators like negation (-) that require one operand, and binary operators like addition (+) that require two operands. Common operators include arithmetic operators like addition and multiplication, increment/decrement operators, relational operators for comparisons, logical operators that use true/false values, assignment operators, and operator precedence defines the order of operations.

Uploaded by

Bakers Guide
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Java Operators: Jayson Angelo E. Vale Cruz

Operators are symbols that perform logical or mathematical functions on operands. There are unary operators like negation (-) that require one operand, and binary operators like addition (+) that require two operands. Common operators include arithmetic operators like addition and multiplication, increment/decrement operators, relational operators for comparisons, logical operators that use true/false values, assignment operators, and operator precedence defines the order of operations.

Uploaded by

Bakers Guide
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Java Operators

Jayson Angelo E. Vale Cruz


Operators
• Are symbols that perform logical or mathematical
functions on operands such as variable or
constants, and objects
Operators
• Unary Operators – requires only one operand
• In Java there at least four unary operators:
• Negation (-)
• Bitwise Complement (~)
• Increment (++)
• Decrement (--)
• Binary Operators – requires two operands
• Example:
• + - for addition or concatenation
• * - for multiplication
• / - for division
Arithmetic Operators
• An operator that perform mathematical operations

Operator Description

+ Addition – adds two operands

Subtraction – subtracts second


-
operand from the first
Multiplication – multiplies two
*
operands
Division – divides numerator by
/
denominator

% Modulo – remainder of the division


Increment and Decrement
• These are operators that only increment or
decrement a value of an operand

Operator Description
It increases the value of an operand
++
by 1
It decreases the value of an operand
--
by 1
Relational Operators
• These are operators that perform a comparison
between operands
Operator Description
It checks whether the left operand is
==
equal to the right operand
It checks whether if the left operand
>
is greater than the right operand
It checks whether if the left operand
<
is less than the right operand
It checks whether if the left operand
>= is greater than or equal the right
operand
It checks whether if the left operand
<= is less than or equal the right
operand
It checks whether the left operand is
!=
“not” equal to the right operand
Logical Operators
• These operators further expand the relational
operator since they add more control to it

Operator Description
An operator that returns true only
&&
when both operands are true
An operator that returns true when
||
at least 1 value is true

! It negates the value of an operand


Assignment Operator
• These are operators that assigns a value from the
right operand to the left operand

Operator Description

+= Assignment with Addition

-= Assignment with Subtraction

*- Assignment with Multiplication

/= Assignment with Division

%= Assignment with Modulo


Operator Precedence
• Is a hierarchy by which you can evaluate a given
expression

You might also like