package com.xu.operator;
public class Demo07 {
public static void main(String[] args) {
int a=10;
int b=20;
a+=b;//a=a+b
System.out.println(a);//30
System.out.println(b);//20
a-=b;//a=a-b
System.out.println(a);//10
System.out.println(b);//20
//字符串连接符 + string
System.out.println(""+a+b);//1020,字符串在前面,后面的进行拼接;
System.out.println(a+b+"");//30,字符串在后面,前面的依旧进行运算;
}
}
\Desktop\JavaSE\out\production\基础语法" com.xu.operator.Demo07
30
20
10
20
1020
30
Process finished with exit code 0