运算符
Ctrl + D 复制当前行
注意点
一元运算符
b = a++;(先赋值,后自增)
c = ++a; (先自增,后赋值)
短路运算
- b && c 如果b为假,直接停止运算
int c = 5;
boolean d = (c<4)&&(c++<4);
System.out.println(d);
System.out.println(c);
- 与字符串相加
System.out.println(b + c + "");
System.out.println("" + b + c);
- 三元运算符
(条件) ?Y :N
package operator;
import java.sql.SQLOutput;
public class Demo08 {
public static void main(String[] args) {
int score = 40;
String type = score < 60 ? "不及格":"及格";
System.out.println(type);
}
}