package com.gao.运算符;
public class d7 {
public static void main(String[] args) {
int a=10;
int b=20;
a+=b;//a=a+b
a-=b;//a=a-b
System.out.println(a);
//字符串连接符 + String
System.out.println(""+a+b);
System.out.println(a+b+"");
}
}
10
1020
30
进程已结束,退出代码为 0
=================================================
package com.gao.运算符;
public class d8 {
public static void main(String[] args) {
//x?y:z
//如果x==true,则结果为z
int scort =50;
String type = scort <60?"不及格":"及格";//必须掌握
//if
System.out.println(type);
}
}
不及格
进程已结束,退出代码为 0
三元运算符及小结
最新推荐文章于 2024-07-06 16:47:20 发布