字符串
每日名言
志高山峰矮,路从脚下伸。——励志名言
package operater;
public class Demo07 {
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);//直接输出的是10与20
System.out.println(a+b+"");//直接输出的是a+b的结果
}
}
三元运算符
package operater;
//三元运算符
public class Demo08 {
public static void main(String[] args) {
//x ? y :z 如果x为真(true),则为y,否则为Z
//int score = 80;//成绩为八十 输出及格
int score = 50;//成绩为五十 输出不及格
String type = score<60?"不及格":"及格";
System.out.println(type);
}
}
每日新闻
工信部:为不少于10万家中小企业提供数字化转型评价诊断服务和解决方案