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

Java-Basics-Operators

The document outlines various types of operators in Java, including arithmetic, relational, bitwise, logical, and assignment operators, along with their descriptions. It also explains the conditional/ternary operator and the instanceof operator, providing syntax examples for each. This serves as a foundational guide for understanding operator usage in Java programming.

Uploaded by

emmasantos2025
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)
4 views

Java-Basics-Operators

The document outlines various types of operators in Java, including arithmetic, relational, bitwise, logical, and assignment operators, along with their descriptions. It also explains the conditional/ternary operator and the instanceof operator, providing syntax examples for each. This serves as a foundational guide for understanding operator usage in Java programming.

Uploaded by

emmasantos2025
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/ 9

Java Basics: Operators

Programming Fundamentals in Java


ARITHMETIC OPERATORS

OPERAT DESCRIPTION
OR
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus
++ Increment (x = x+1)
-- Decrement (x = x-1)
RELATIONAL OPERATORS

OPERAT DESCRIPTION
OR
== equal to
!= not equal to
> greater than
< less than
>= greater than or equal to
<= less than or equal to
BITWISE OPERATORS

OPERAT DESCRIPTION
OR
& bitwise AND
| bitwise OR
^ bitwise XOR
~ 1’s Complement
<< Binary shift left
>> Binary shift right
>>> zero fill right shift
LOGICAL OPERATORS

OPERAT DESCRIPTION
OR
&& logical and
|| logical or
! logical not
ASSIGNMENT OPERATORS

OPERAT DESCRIPTION
OR
= simply assign
+= add then assign
-= subtract then assign
*= multiply then assign
/= divide then assign
%= get the modulo then assign
<<= binary shift left then assign
>>= binary shift right then
assign
ASSIGNMENT OPERATORS

OPERAT DESCRIPTION
OR
&= do bitwise AND then assign
|= do bitwise OR then assign
^= do bitwise XOR then
assign
CONDITIONAL/TERNARY OPERATOR

This is used to evaluate Boolean expressions. The goal of


the operator is to decide which value to assign in the
variable.
syntax:
(<condition>) ? <value if true> : <value if false>;
INSTANCEOF OPERATOR

This is used only for variable having reference data type


(object reference variable). The operator checks whether the
variable is of a particular type of class or interface.
syntax:
<object_reference_variable> instanceof
<classname/interfacename>

You might also like