/**
* 字符串连接符:字符串和字符串拼接 字符串和其他类型拼接
* //问:当多个类型参与的运算,+是运算?还是拼接?
*/
public static void main(String[] args) {
//1.字符串类型:String
String s = "可以任意写,写什么都是对的";//双引号括起来的内容就是字符串的直接量
int score = 97;
String result = "该学生的分数是" + score;
System.out.println(result);
//2.字符串拼接的扩展
String res = " ";
System.out.println(res + 100);// 100
System.out.println(100 + res);//100
System.out.println(100 + res + 200);//100 200
System.out.println(100 + 200 + res);//300
System.out.println(res + 100 + 200);// 100200
System.out.println(100 + 200 + res + 300 + 400);//300 300400
res = 100 + 200 + res;
System.out.println(res);//300
/**
* 结论:观察左右两边的内容,如果都为数值,则运算,如果有字符串则拼接
*/
//判断当前成绩是否90以上,如果是则打印rue,如果不是则打印false
boolean b = score >= 90 ? true : false;
System.out.println(b);
//判断当前成绩是否90以上,如果是则打印优秀,不是则打印不及格
String b1 = score >= 90 ? "优秀" : "不及格";
System.out.println(b1);
//2.三目运算符的嵌套
//判断一个数字是否为整数或负数或0
int i = 12;
String res2 = i > 0 ? "正数" : (i < 0 ? "负数" : "0");
System.out.println(res);
}