1.条件运算符?:

个人理解:?:运算符功能跟if else比较相似,优点是?:运算符运算效率更高,能使代码更加简短

示例:

public class Demo1 {
    public static void main(String[] args) {
        int source=80;
        String result = source <80 ?"不及格":"及格";
        System.out.println(result);
    }
}

若source<80成立,则输出:前数据,反之输出:后数据

2.扩展赋值运算符+= -= *= /=

public class Demo1 {
    public static void main(String[] args) {
        int source=80;
        source+=10;
        System.out.println(source)
    }
}

source+=10,其意思为source=source+10,使代码简洁,其余同上


You got to put the past behind you before you can move on.