|| operator in Java
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
One thing to keep in mind is the second condition is not evaluated if the first one is true, i.e. it has a short-circuiting effect. Used extensively to test for several conditions for making a decision.
Condition1 || Condition2 // returns true if one of the conditions is true.
Below is an example to demonstrate || operator:
a is an alphabet.