Java provides three logical operators such as :
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.
class LogicalDemo { public static void main(String args[]) { int x=10,y=15; boolean p; boolean q; p=(x<y)&&((x+y)>x); q=(x>=y)||((x+y)<x); System.out.println(p); System.out.println(q); } }
Output:
true
false
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