当前位置:网站首页>逻辑运算符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); } } |
运算结果:

边栏推荐
- 备赛笔记:matplotlib学习笔记a
- 对Rapidly-exploring Random Trees(RRT)路径规划方法的理解
- go web
- 电路故障的分析简略
- Talk about the redis cache penetration scenario and the corresponding solutions
- WAV和PCM的关系和区别
- 新一代云数据库的引领者---AWS
- MySQL learning notes - constraints
- Yunxi focuses on store broadcast solutions to accelerate global layout
- Redis集群主备缓存区满了导致主备频繁倒换
猜你喜欢

Detailed explanation of RAID disk array, raid classification, advantages and disadvantages

OpenCV基于DLCO描述子匹配

云犀&腾讯云达成战略合作,加速拓展全球直播市场

String correlation function (II)

HCIP(4)

Preparation Notes: Matplotlib learning notes a

Gradient button function button drawing C language example

HCIP(5)

机器学习(上)吴恩达

C language drawing example - flower pattern
随机推荐
电路故障的分析简略
HCIP(8)
Acwing786. 第k个数
S32K148_CAN驱动(裸机开发)
阿趣的思考
Day 4 homework
hcip第二天笔记
Yunxi and Tencent cloud have reached a strategic cooperation to accelerate the expansion of the global live broadcast market
PPPoE dial up
Database daily question --- day 25: bank account summary II
Travail du quatrième jour
RAID 磁盘阵列详解,RAID分类及优缺点
What is the relationship between softmax and cross enterprise?
useEffect 总结
hicp第一天笔记
详细分析一个ROS2 CMakeLists.txt文件
对Rapidly-exploring Random Trees(RRT)路径规划方法的理解
Experiment the next day
Thoughts on ahe investment
Detailed explanation of SQL blind annotation