Professional Documents
Culture Documents
Java 02
Java 02
Java 02
tors in Java
In Java, operators are used to perform various operations on data. Here, we’ll
explore assignment, comparison, and logical operators.
• ==: Equal to
• !=: Not equal to
Examples:
int a = 10;
int b = 5;
• ||: Logical OR
1
• !: Logical NOT
Examples:
boolean isTrue = true;
boolean isFalse = false;
In this example, we use the greater than or equal to (>=) and logical AND
(&&) operators to check if the age variable falls within the range of 18 to 65,
resulting in true.
Understanding these operators is essential for controlling program flow and
making decisions in Java.