当前位置:网站首页>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);
边栏推荐
- 2022年全国最新消防设施操作员(高级消防设施操作员)模拟题及答案
- Custom control - round dot progress bar (imitating one key acceleration in security guard)
- Text editor for QT project practice - Episode 10
- JS dynamically generates variable names and assigns values
- 2021-09-12
- Easy to wear - drop down radio
- Activity startup process
- In the process of enterprise development, I found that a colleague used the select * from where condition for update
- 生成订单30分钟未支付,则自动取消,该怎么实现?
- Text editor of QT project practice ---------- episode 11
猜你喜欢

Rich text tables, lists, pictures

使用 Loki 微服务模式部署生产集群

I brush the question I - copy the linked list with random pointer

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

Easy to wear - drop down radio

How to reduce the font size of custom controls (optimize the round dot progress bar)

2021-09-12

【微服务|Sentinel】Sentinel快速入门|构建镜像|启动控制台

Usage of ViewModel and livedata in jetpack

2022 crane driver (limited to bridge crane) examination question bank simulated examination platform operation
随机推荐
51 single chip microcomputer multi computer communication
生成订单30分钟未支付,则自动取消,该怎么实现?
Can communication experiment between C and C
2021-04-18
Text editor of QT project practice ---------- episode 11
Sanic服务启动失败
Punch smart spirit 1. The brand is attractive. What is the strength of the product?
Tiktok wallpaper applet, starlight wallpaper applet version 2.0, upgraded version
Only positive integers can be entered in the text box
Solution to network access packet loss of Tencent cloud international ECS
最新QQ微信域名防红PHP程序源码+强制跳转打开
2022熔化焊接与热切割复训题库模拟考试平台操作
108页(4万字)未来公寓智能化设计平台项目方案建议书2022版
Thermodynamic diagram display correlation matrix
打卡smart精灵#1,品牌不缺吸引力,产品本身实力如何?
adb shell getevent
The picture of wechat official account can not be displayed normally
Scala IO read by character
I 刷题 I — 复制带随机指针的链表
The interview questions and answers for the high-frequency software test of Dachang help you prepare for the golden nine silver ten