当前位置:网站首页>Distinguish between i++ and ++i seconds
Distinguish between i++ and ++i seconds
2022-06-25 01:04:00 【Play in the clouds】
i++ First use and then add ;++i It's adding before using
If you don't understand, look at the case :
Case study 1:
int i=1;
i++;// Use first, then add , The code goes to this line i Is still 1 unchanged ( First use )
System.out.println("i:"+i);// Come to this line i It has been used up , It's time to add so +1 yes 2
int j=1;
++j;// Add before use , The code goes to this line first +1, therefore j Turned into 2
System.out.println("j:"+j);// Post use so j yes 2
i- -,- -i Empathy
Case study 2:
int i=1;
int he= i++ + ++i ;//1+3
System.out.println(he);//4
int j=1;
int sum= j-- + --j ;//1-(-1)
System.out.println(sum);//0
Case study 3:
int i=1;
int sum=i++ + ++i + i-- + --i ;//1+3+3+1=8
System.out.println(sum);
边栏推荐
- Golang示例续期锁:Redis+Channel+sync.Mutex
- Text editor for QT project practice -- Episode 9
- QT (35) - operate excel qxlsx qaxobject
- 2022年起重机司机(限桥式起重机)考试题库模拟考试平台操作
- Sliding window technology based on byte in transport layer
- The drawableleft of the custom textview in kotlin is displayed in the center together with the text
- QT (36) -rapidjson parsing nested JSON
- The acceleration of 100 km is only 5.92 seconds, and the willanda high-performance version leads with the strength of high-energy products
- Punch smart spirit 1. The brand is attractive. What is the strength of the product?
- Mobile security tool jar
猜你喜欢

QT(35)-操作EXCEL-QXlsx-QAxObject

2022 melting welding and thermal cutting recurrent training question bank simulated examination platform operation

Scala IO reads by lexical units and numbers

2022年全国最新消防设施操作员(高级消防设施操作员)模拟题及答案

iNFTnews | 国内NFT发展仅限于数字藏品吗?
![[redis realizes seckill service ②] solution to oversold problem](/img/b6/3073def06a56565894c28e49767e3e.png)
[redis realizes seckill service ②] solution to oversold problem

Examination questions and mock examination for safety management personnel of hazardous chemical business units in 2022

Use coordinatorlayout+appbarlayout+collapsingtoolbarlayout to create a collapsed status bar

Infotnews | is the development of domestic NFT limited to digital collections?

Simulation questions and answers of the latest national fire facility operator (senior fire facility operator) in 2022
随机推荐
【微服务|Sentinel】Sentinel快速入门|构建镜像|启动控制台
[redis realizes seckill service ④] one order for one person, and cannot be purchased repeatedly
Eliminate duplicate dependencies
Kubernetes 架构核心组件工作原理解析
生成订单30分钟未支付,则自动取消,该怎么实现?
Redis + Lua implementation of distributed interface current limiting
Sliding window technology based on byte in transport layer
2021-11-05
Use of navigation and navigationui
Scala sample class case calculate
ros(25):rqt_ image_ View reports an error unable to load plugin for transport 'compressed', error string
Activity startup process
iNFTnews | 国内NFT发展仅限于数字藏品吗?
移动安全工具-jar
Thingsboard - rest API obtains and refreshes tokens
[micro service sentinel] real time monitoring | RT | throughput | concurrency | QPS
Previous basic review (link)
QT (36) -rapidjson parsing nested JSON
通过kubernetes可视化界面(rancher)安装kibana
The problem of multiple callback of video ads stimulated by applets (offcolse problem)