com.xu.operator.Demo07
作者:互联网
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
标签:20,System,println,Demo07,operator,xu,com,out 来源: https://www.cnblogs.com/xunzhao26/p/14802846.html