当前位置:网站首页>逻辑运算符1(阁瑞钛伦特软件-九耶实训)
逻辑运算符1(阁瑞钛伦特软件-九耶实训)
2022-07-17 16:47:00 【九耶(钛伦特)】
逻辑运算符
运算符:
&& 与
|| 或
! 非
语法:
操作数1 && 操作数2 操作数1 || 操作数2 !操作数1 |
特点:
逻辑运算符的操作数必须是boolean类型的。
运算规则:
&& 运算:
表达式 | 结果 |
true && false | false |
true && true | true |
false && true | false |
false && false | false |
|| 运算:
表达式 | 结果 |
true || false | true |
true || true | true |
false || true | true |
false || false | false |
! 运算:
! true | false |
! false | true |
示例:
publicclass Demo { publicstaticvoid main(String[] args) { System.out.println(true && false); System.out.println(true && true); System.out.println(false && true); System.out.println(false && false);
System.out.println(true || false); System.out.println(true || true); System.out.println(false || true); System.out.println(false || false);
System.out.println(! true); System.out.println(! false); } } |
运算结果:
边栏推荐
猜你喜欢
Do you still need to release the database connection manually with typeorm
Notes on the fifth day
10分钟自定义搭建行人分析系统,检测跟踪、行为识别、人体属性All-in-One!
Opencv based on DLCO descriptor matching
MySQL learning notes - constraints
Opencv:06 morphology
What is the relationship between softmax and cross enterprise?
Day 1 Experiment
PyTorch版:集成注意力和MobileNet的YOLOv4
C language drawing example - flower pattern
随机推荐
GET 请求和 POST 请求的区别和使用
In 2022, how to choose cross end technology solutions?
Hcip fourth day notes
第四天作业
第五天笔记
Acwing785. Quick sort
psd. JS parsing PSD file
Leetcode 150. Evaluation of inverse Polish expression
35岁以上的测试/开发程序员职业生涯走向,是职场转折点吗?
Dynamic memory planning
hicp第三天
Acwing785. 快速排序
结构体内存对齐、位段、联合
备赛笔记:matplotlib学习笔记a
OpenCV基于DLCO描述子匹配
Understanding of rapid exploring random trees (RRT) path planning method
Do you still need to release the database connection manually with typeorm
Leetcode 239. Sliding window maximum
超声波传感器(CHx01) 学习笔记 Ⅲ - I2C读写操作
Core base station_ The error "no gateways configured" is reported when starting the CPA file