One thing to keep in mind is the second condition is not evaluated if the first one is false, i.e. it has a short-circuiting effect. Used extensively to test for several conditions for making a decision.
Condition1 && Condition2 // returns true if both the conditions are true.
Below is an example to demonstrate && operator:
30 is the largest number.
- & Operator in Java with Examples
- new operator in Java
- || operator in Java
- Why overriding both the global new operator and the class-specific operator is not ambiguous?
- Difference between concat() and + operator in Java
- Double colon (::) operator in Java
- Java Ternary Operator Puzzle
- new operator vs newInstance() method in Java
- Ternary operator vs Null coalescing operator in PHP
- instanceof operator vs isInstance() method in Java
- Java.util.LinkedList.poll(), pollFirst(), pollLast() with examples in Java
- Java.lang.Short toString() method in Java with Examples
- Java.util.concurrent.RecursiveTask class in Java with Examples
- Java lang.Long.reverse() method in Java with Examples
- Java.util.Collections.disjoint() Method in java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.