口诀:成员括号,单目四则,移位关系,位与逻辑,条件赋值
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package test;
/**
*
* @author huanghuankun
*/
public class OprPriority {
//运算符优先级:成员括号,单目四则,移位关系,位与逻辑,条件赋值
public static void main(String[] agrs) {
int i = 6;
int j = 8;
int m = 7;
int k = 10;
if (!(i > j ^ m > k++)) {
k++;
}
System.out.println("i > j ^ m > k++ ="+(i > j ^ m > k++));
System.out.println("k=" + k);
}
}
输出结果:
i > j ^ m > k++ =false
k=13