What Does || in Java Mean

|| operator in Java || is a type of Logical Operator and is read as “OR OR” or “Logical OR“.

What is || and && in Java?

Logical operators evaluate the second expression only when necessary. For example, true || anything is always true, so Java does not need to evaluate the expression anything . Likewise, false && anything is always false.

Can you use and/or in Java?

Java has two operators for performing logical And operations: & and &&. Both combine two Boolean expressions and return true only if both expressions are true. Here’s an example that uses the basic And operator (&): … If one is false or both are false, the & operator returns false.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest