23 Java语言基础逻辑运算符的基本用法

 1 public class HelloWorld {
 2     public static void main(String[] args) {
 3         int a  = 10;
 4         int b =20;
 5         int c =30;
 6         
 7         System.out.println(a<b & b<c);   //true
 8         System.out.println(a>b & a<c);    //false
 9         System.out.println(a>b & b<c);      //fals
10     }
11 }

 

& 遇到 false 就是false

|  遇到 true 就是true  

^  两边相同 false   两边不同为true   异或:一男一女为true

!  取反

 

posted @ 2017-01-21 11:07  panw3i  阅读(111)  评论(0编辑  收藏  举报