Lecture 07 - Java Operators
Lecture 07 - Java Operators
1. Arithmetic operators
2. Assignment operators
3. Relational operators
4. Logical operators
5. Bit-wise operators
6. Conditional Operators
1. Arithmetic Operators:
These operators are used with numeric values to perform common mathematical operations.
2. Assignment Operators:
3. Relational Operators:
4. Logical Operators:
For example, in the table below, let x = 10 (0000 1010 in binary) and y = 4 (0000 0100 in
binary)
6. Conditional Operators:
The conditional operator is the only ternary operator (operator that takes three arguments) in
Java. The operator evaluates the first argument and, if true, evaluates the second argument. If the
first argument evaluates to false, then the third argument is evaluated. The conditional operator is
the expression equivalent of the if-else statement.
Example 6
Output:
c = true