java中postfix与一元和加法有什么区别 [英] What is the Difference between postfix and unary and additive in java

查看:153
本文介绍了java中postfix与一元和加法有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我了解两个"TRUE"和"FALSE"输出之间的区别. 并且指导我如何在Oracle Docs中获得与逻辑和运算符相关的主题.

Please help me to understand what is the difference between two "TRUE" and "FALSE" outputs. and also guide me how to get this logic and operator related topics in Oracle Docs.

int i = 1;
int j = 2;

System.out.println(i==j--);// FALSE
j = 2;
System.out.println(i==j-1);//TRUE
j = 2;
System.out.println(i==--j);//TRUE

推荐答案

i == j--表示i == j; j = j - 1;

i == j-1表示i == (j-1);

i == --j表示j = j - 1; i == j;

这里是运算符优先级表,按从最高到最低.例如,-的优先级高于==,这就是为什么i==j-1表示i==(j-1)

Here is the operator precedence table, in order from highest to lowest. For example, - has higher precedence than ==, which is why i==j-1 means i==(j-1)

这篇关于java中postfix与一元和加法有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆