Home > Java > javaTutorial > What does & mean in Java?

What does & mean in Java?

little bottle
Release: 2019-05-25 09:11:55
Original
19002 people have browsed it

When writing Java code, it is inevitable to use various operators. Here I will introduce to you the & in Java. Do you want to know what it means? Then let’s find out with the editor.

What does & mean in Java?

& is a bitwise operator - AND, similar to | (or), ! (not).

In the computer, when & is used as a bit operation, 1&1=1, 1&0=0, 0&0=0;

When we usually use this, it is very There are few, and they are generally used for judgment. If both are true, it is true. I believe you must have learned AND or NOT when you studied mathematics before. This is the same as mathematics.

PS: When mentions &, it will definitely mention &&, && is the logical AND , for example, 2 conditions, boolean a=2>3&&1>3, when judging 2>3 is false When , the second condition 1>3 will not be judged, and a=false will be directly judged. When using &, all 2 conditions will be judged, and then a will be assigned false, So generally make logical judgments When using &&, it will be more efficient!

The above is the detailed content of What does & mean 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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template