java中&& 的运算优先级高于||

public class First {
    public static void main(String[] args) {
        boolean a = false;
        boolean b = true;
        boolean c = false;
        if (a || b && c){
            System.out.println("ok");
        }
    }
}

上面什么也不输出,当把c改为true输出为ok 由此可见,是先运算 b&&c 再运算 a || 

原文地址:https://www.cnblogs.com/prader6/p/12058952.html