三次运算符
- 条件运算符
public static void main(String[] args) {
//三元运算符
int score = 80;
String type = score<60 ?"不及格" :"及格";
System.out.println(type);
}
}
字符串连接符
- 拼接:
public static void main(String[] args) {
int a =3;
int b =4;
System.out.println(a+=b);
System.out.println(b);
//字符串连接符
int c = 10;
int d = 20;
System.out.println(""+c+d);
System.out.println(c+d+"");
}
}
(""+a+b)“”在前面的会产生拼接,否则将不会
运算优先级
总述:学完之后要做到代码能自己能看懂代码,自己要多练习哦