字符串连接符与条件运算符

//面试题
int a1=10;int b1=20;
System.out.println(" "+a1+b1);//字符串在前,则相连
System.out.println(a1+b1+" ");//字符串在后面,则加减运算
//条件运算符?:
int score=90;
String type=score>60 ?"及格":"不及格";
System.out.println(type);

posted @ 2025-03-18 20:59  骆驼刺破仙人掌007  阅读(3)  评论(0)    收藏  举报