package operator;
?
public class Demo07 {
public static void main(String[] args) {
int a = 10;
int b = 20;
?
/*
a+=b;
a-=b;
*/
// 字符串连接符 +
System.out.println(""+a+b);//空字符串在前 后面也当做字符串连接
System.out.println(a+b+"");//a+b在前 先计算 在和空字符串连接
?
System.out.println("===========================");
//三元运算符
//x?y:z
//如果x为真,则结果为y,否则结果为z
int score = 50;
String type = score<60?"不及格":"及格";
System.out.println(type);
?
}
}
?
原文:https://www.cnblogs.com/Alirious/p/14804085.html