Java Design Pattern
Introduction to Java 10
Introduction to Java 11
Introduction to Java 12

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:

X < y && x+y > y

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 :
class LogicalDemo
	public static void main(String args[])
		int x=10,y=15;
		boolean p;
		boolean q;



About the Author

Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc