Home >Java >JavaBase >What are the logical operators in java

What are the logical operators in java

王林
王林Original
2020-04-27 14:34:179134browse

What are the logical operators in java

What are the logical operators in Java?

Logical operators include logical AND (&&), logical OR (||) and logical NOT (!). The first two are binary operators, and the latter one is a unary operator.

Java provides a "short-circuit" function for logical AND and logical OR, that is, when performing operations, the value of the expression on the left side of the operator is first calculated. If this value is used, the value of the entire expression can be obtained. Then the calculation of the expression on the right side of the operator is skipped, otherwise the expression on the right side of the operator is calculated and the value of the entire expression is obtained.

(Recommended video tutorial: java video)

Please see the picture below for specific examples:

What are the logical operators in java

Recommended tutorial :java introductory program

The above is the detailed content of What are the logical operators in java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn