public class Demo07 {public static void main(String[] args) {int a = 10;int b = 20;a+=b; // a = a + ba-=b; // a = a - bSystem.out.println(a); // 10// 字符串连接符 +, String, 有String类型,会把后面的转为StringSystem.out.println(""+a+b); // 1020System.out.println(a+b+""); // 30// 三元运算符 条件运算符// x ? y : z// 如果x == true, 则结果为y,否则结果为zint score = 50;String type = score<60 ? "不及格":"及格";System.out.println(type); // 不及格}
}
https://www.bilibili.com/video/BV12J41137hu?p=30&spm_id_from=pageDriver