Arithmetic Name Operator Name Example
Java Assignment Operator
Use the Assignment Operator when you need to assign a value to a variable. Assignment means assigning the value of right operand(s) to the left operand.
Arithmetic Assignment Operator Name Example
Java Relational/ Comparison operators
Compare two values with Java relational operators, which is also known as Comparison Operators.
Java Relational Operator Name Example
= =' Equal a == b isn’t true
!= Not Equal a != b returns true
> Greater Than a > b isn’t true
< Less Than a < b is true
>= Greater than or equal to a >= b isn’t true
<= Less than or equal to a <= b is true
Here’s an example,
Java Logical operators
Logical operators combine conditional statements. Considering Boolean variables a and b,
Java Logical Operators Name Example
&& Logical AND operator a && b is true if a and b are both true
|| Logical OR Operator a || b is true if either a or b is true
^ Logical XOR operator a xor b is true if either a or b is true (not both)
! Logical NOT Operator !a is true if a is not true
Here’s the output,
Java Ternary/ Conditional Operator
Conditional operator evaluates Boolean expressions, with has three operands. It is also known as the ternary operator. The role is to assign a value to a variable, from two given set options.
Here’s how to use it,
Bitwise Operator
These operators only work with the following data types,
Bitwise operators are discussed in the next lesson.
0 comments:
Post a Comment