当前位置:网站首页>Short circuit effect of logical operators short circuit and short circuit or
Short circuit effect of logical operators short circuit and short circuit or
2022-07-25 22:25:00 【Raise your eyes and look far away】
// Short circuit and &&
int x=8;
int y=9;
System.out.println((++x==y)&&(++x!=y));//true
System.out.println(x);//10 // Short circuit and &&
int x=8;
int y=9;
System.out.println( (++x!=y)&&(++x==y));//false
System.out.println(x);//9 // Monocular and &
int x=8;
int y=9;
System.out.println((++x==y)&(++x!=y));//true
System.out.println(x);//10 // Monocular and &
int x=8;
int y=9;
System.out.println( (++x!=y)&(++x==y));//false
System.out.println(x);//10 && and & The difference between :
&& Short circuit function , When && The expression on the left is false When , Directly judge the whole && The result of operation is false, && The right side is no longer calculated
& No short circuit function , No matter & The result of the expression on the left is true still false,& The expressions on the right have to be evaluated
|| and | The difference between :
|| Short circuit function , When || The expression on the left is true When , Directly judge the whole || The result of operation is true,|| On the right, No recompute
| No short circuit function , No matter | The result of the expression on the left is true still false,| The expressions on the right have to be evaluated
// Short circuit or ||
int x=8;
int y=9;
System.out.println((++x==y)||(++x!=y));//true
System.out.println(x);//9 // Short circuit or ||
int x=8;
int y=9;
System.out.println( (++x!=y)||(++x==y));//false
System.out.println(x);//10 // Monocular or |
int x=8;
int y=9;
System.out.println((++x==y)|(++x!=y));//true
System.out.println(x);//10 // Monocular or |
int x=8;
int y=9;
System.out.println( (++x!=y)|(++x==y));//false
System.out.println(x);//10
边栏推荐
- Title: give a group of arrays, arranged from large to small and from small to large.
- 力矩电机控制基本原理
- SQL basic statement DQL select and extract DML insert delete
- To light up all the positions in the string that need to be lit, at least a few lights are needed
- VIM usage record
- Arcgis10.2 configuring postgresql9.2 standard tutorial
- 【Leetcode】502.IPO(困难)
- 字符型常量和字符串常量的区别?
- Why is the integer type 128 to byte -128
- ArcGIS中的WKID
猜你喜欢

Perform Jieba word segmentation on the required content and output EXCEL documents according to word frequency

Data quality: the core of data governance

【PMP学习笔记】第1章 PMP体系引论

Don't know mock test yet? An article to familiarize you with mock

还不懂mock测试?一篇文章带你熟悉mock

QML module not found

ArcGIS10.2配置PostgreSQL9.2标准教程

微信发卡小程序源码-自动发卡小程序源码-带流量主功能

MapGIS格式转ArcGIS方法

Arcgis10.2 configuring postgresql9.2 standard tutorial
随机推荐
Compile and decompile
internship:普通常用的工具类编写
SMART S7-200 PLC通道自由映射功能块(DO_Map)
kubernetes之VictoriaMetrics单节点
Ffmpeg plays audio and video, time_ Base solves the problem of audio synchronization and SDL renders the picture
About vscode usage+ Solutions to the problem of tab failure
torchvision
VIM usage record
How many bytes does Boolean occupy?
It's over. I went to work for three months and became bald
Call of addition, subtraction, multiplication and division of integer type only
Minor GC 和 Full GC 有什么不同呢?
Why does redis choose single thread?
Wkid in ArcGIS
Based on if nesting and function call
3dslicer import cone beam CT image
MySQL - subquery - column subquery (multi row subquery)
『SignalR』. Net using signalr for real-time communication
启牛商学院和微淼商学院哪个靠谱?老师推荐的开户安全吗?
torchvision