Introduction To Java Operators
Introduction To Java Operators
Operators
Operators are symbols used in Java to perform various operations on variables
and values. They allow you to manipulate data and make decisions in your
Java programs. This presentation will cover the most commonly used Java
operators and their functionality.
by Sahil Kshirsagar
Arithmetic Operators
+, -, *, / % Examples
++ --
Increment operator that increases the value of a Decrement operator that decreases the value of a
variable by 1. variable by 1.
Bitwise Operators
& Bitwise AND
| Bitwise OR
^ Bitwise XOR
~ Bitwise NOT
Bitwise operators work on the individual bits of integer values, allowing you to perform low-level
manipulations on data.
Ternary Operator
?: Example
The ternary operator is a shorthand for an int x = 10, y = 20;
int max = (x > y) ? x : y;
if-else statement. It evaluates an
System.out.println(max); // Output: 20
expression and returns one of two values
based on whether the expression is true or
false.