扩展运算符+三元运算符
package operator;
public class Operator {
public static void main(String[] args) {
//扩展赋值运算符
int a = 10;
int b = 20;
//a += 20; //a = a+20;
//b -= 20; //b = b-20;
//System.out.println(a); //30
//System.out.println(b);//0
//面试题 下面两个输出有什么区别?
System.out.println(""+a+b); // 1020
System.out.println(a+b+""); // 30
//三元运算符 条件?结果1:结果2
double score = 80;
String type = score <60 ? "不合格":"合格";
System.out.println(type); //合格
}
}