Home > Java > JavaBase > body text

What are the logical operators in java

王林
Release: 2020-05-08 16:45:51
Original
9085 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!