今天在这里总结一下常用的逻辑运算符,方便大家查找。
"&&" 的区别,双个"&",左边为假,右边不进行计算。
"||" 的区别;,左边为真,右边不进行计算。
下面是追加字符串的方法:
String string = "hello";
string +="world";
System.out.println(string);
打印结果就是:“helloworld”
注意:
string +="world";
中的“+=”必须是紧挨着,没有空格,不然会报错Syntax error on tokens, they can be merged to form +=