package operrator;标签:逻辑,0011,System,运算符,&&,println,out From: https://www.cnblogs.com/lishaonian/p/16745215.html
//逻辑运算符
public class Dmeo02 {
public static void main(String[] args) {
//与and 或or 非:取反
boolean a=true;
boolean b=false;
System.out.println("a&&b:"+(a&&b));
System.out.println("a||b:"+(a||b));
System.out.println("!(a&&b):"+!(a&&b));
System.out.println("==================================");
//位运算
/*
A=0011 1100
B=0000 1101
-------------------------------
A&B 0000 1100
A|B 0011 1101
A^B 0011 0001
~B 1111 0010
2*8=16 2*2*2*2
<<左移 :相当于*2
>>右移 :相当于/2
*/
System.out.println(2<<3);
// 2的三次方
int r=10;
int t=20;
r+=t; // a=a+b
//r-=t; // a=a-b
System.out.println(r);
//字符串连接符 +
System.out.println(r+t);
System.out.println(""+r+t);
System.out.println(r+t+"");
}
}