Java Logical Operators:
Java provides three logical operators such as :
- && Logical-AND
- || Logical-OR
- ! Logical not
The logical operators && and || are used when we want to form compound conditions by combining two or more relations. For example:
Here this expression contains two expressions combined by && operator.
- So according to the concept, if both expressions are true, then the output will be true, otherwise it will be false.
- In case of logical or (||) operator, if any one expression is true, then the result is true, otherwise it is false.
Let's see a program :
public static void main(String args)