当前位置:网站首页>分分钟掌握---三目运算符(三元运算符)
分分钟掌握---三目运算符(三元运算符)
2022-04-23 14:12:00 【Zinksl】
:::
根据 遗忘曲线:话说,种一颗树的最佳时间是十年前与现在
:::
三元运算符的格式:
判断条件 ? 值1 : 值2;
执行流程:
1 判断条件是否为真?
2 如果判断条件为真,则 值1 赋给这这条语句的结果;
3 如果判断条件为假,则 值2 赋给这这条语句的结果;
public void operator(){
int a,b,c;
a = 10;
b = 20;
//第一种情况判断条件(b>a)为真
c = b>a ? a:b;//c的值为10;
//第二种情况判断条件(b<a)为假
c = b<a ? a:b;//c的值为20;
}
版权声明
本文为[Zinksl]所创,转载请带上原文链接,感谢
https://blog.csdn.net/Zinkse/article/details/123867059
边栏推荐
- Mysql的安装过程(已经安装成功的步骤说明)
- mysql 5.1升级到5.69
- TLS/SSL 协议详解 (28) TLS 1.0、TLS 1.1、TLS 1.2之间的区别
- After entering the new company, the operation and maintenance engineer can understand the deployment of the system from the following items
- js 键值判断
- 错误:无法远程查找到密钥 “428F7ECC7117F726“
- ansible及常用模块的使用
- Returns the subscript after array sorting
- Docker篇 (五) MySQL的安装
- MySQL lock database lock
猜你喜欢

openstack理论知识

Uni app message push

Notes on Visio drawing topology

redis数据库讲解二(redis高可用、持久化、性能管理)

01-nio basic ByteBuffer and filechannel

TLS/SSL 协议详解 (28) TLS 1.0、TLS 1.1、TLS 1.2之间的区别

Nacos作为配置中心(四) 使用Demo

C语言知识点精细详解——初识C语言【1】

Processing MKDIR: unable to create directory 'AAA': read only file system

API Gateway/API 网关(四) - Kong的使用 - 集成Jwt和熔断插件
随机推荐
JS recursion (1)
MySQL数据库讲解(九)
Get the thread return value. Introduction to the use of future interface and futuretask class
C语言知识点精细详解——初识C语言【1】
逻辑卷创建与扩容
KVM learning resources
Processing MKDIR: unable to create directory 'AAA': read only file system
redis数据库讲解二(redis高可用、持久化、性能管理)
Web page, adaptive, proportional scaling
Introduction to loan market quotation interest rate (LPR) and loan benchmark interest rate
Introduction to the use of countdownlatch and cyclicbarrier for inter thread control
Logback logger and root
Storage path of mod subscribed by starbound Creative Workshop at Star boundary
OpenSSH的升级、版本号的修改
ThreadGroup ThreadGroup implémente l'interface threadfactory en utilisant la classe Introduction + Custom thread Factory
MySQL数据库讲解(八)
剑指offer刷题(1)--面向华为
基础正则表达式
TUN 设备原理
进入新公司,运维工程师从下面这几项了解系统的部署