字符串运算符&&三元运算符

public class Demo01 {
public static void main(String[] args) {
//字符串连接符 + String
int a=20;
int b=10;
System.out.println(""+a+b);
System.out.println(a+b+"");
//三元运算符
//x ? y : z
//如果x==true,则结果为y,否则结果为z
int score = 80;
String type = score < 60 ? "不及格" : "及格";//必须掌握
System.out.println(type);

}
}
run

2010
30
及格

posted @ 2022-03-13 21:38  HFUUwzy  阅读(54)  评论(0)    收藏  举报