1 Star 0 Fork 1

LiuYan/Java

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
Part03.java 903 Bytes
Copy Edit Raw Blame History
liuyan authored 2023-05-10 13:21 +08:00 . java9、java10、java11
/**
* @author LiuYan
* @date 2021/11/12 8:47
*/
public class Part03 {
public static void main(String[] args) {
boolean b1 = true;
boolean b2 = false;
boolean b3 = true;
// & 全真才真,一假全假
boolean result = b1 & b2;
System.out.println(result);
// | 一真则真,全假才假
boolean result2 = b1 | b2;
System.out.println(result2);
// ! 取反
boolean result3 = !b1;
System.out.println(result3);
// && 短路与是只要遇见false立马返回false,后面不再执行
int a = 12;
int b = 13;
boolean result4 = (a < 10) && (b > 20);
System.out.println(result4);
// || 短路或是只要遇见true立马返回true,后面的不再执行
boolean result5 = (a < 10) || (b < 20);
System.out.println(result5);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/Liu-Yan-Code/java.git
git@gitee.com:Liu-Yan-Code/java.git
Liu-Yan-Code
java
Java
master

Search