package test_package;
/**
* 字符串运算符
* @author
*
*/
public class TestOperator05 {
public static void main(String[] args) {
String a = "3";
int b = 4;
int c = 5;
char d = 'a';
System.out.println(a+b+c);//因为3是字符串,后面都是字符串连接
System.out.println(b+c+a);//9+a,a是字符串
System.out.println(d+4); //97+4=101,d在ASCLL码中是97
}
}
/**
* 条件运算符(三元运算符)
* @author
*
*/
public class TestOperator06 {
public static void main(String[] args) {
int score = 80;
int x = -100;
String type = score<60?"不及格":"及格";
System.out.println(type);
if(score<60){
System.out.println("不及格");
}else{
System.out.println("及格");
}
System.out.println(x > 0 ? 1 : (x == 0 ? 0 : -1));
}
}