Java Reference
In-Depth Information
This would produce the following result:
p == q = false
p != q = true
p > q = false
p < q = true
q >= p = true
q <= p = false
These relational operators are used in Decision making and Branching to decide the execu-
tion control in a program.
Logical Operators
There are three logical operators in Java. These operators are logical AND, logical OR and
logical NOT. The logical operators logical AND ,logical OR are used when there is a need
to form a compound condition with a combination of two or more relational expressions.
Meaning and Description
Operator
This operator is known as Logical AND operator. When
both operand are true or non-zero, then the condition is
true otherwise false
&&
This operator is known as Logical OR operator. When at
least one operand is true or non-zero, then the condition
is true otherwise false
||
This operator is known as Logical NOT operator and
Used to reverse the logical state of any operand. If a con-
dition is false then this operator will make it true and if
true then it will make false.
!
Search WWH ::




Custom Search