package com.zhen.operator; //三元运算符?: 拓展赋值运算符 +=, -=,*= ,/= 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); System.out.println(b); System.out.println("============================================="); //字符串连接符 + ,String System.out.println(a+b); System.out.println(""+a+b); System.out.println(a+b+""); //字符串在a+b前面则都会按照String类型进行连接, //字符串子啊字符串后面则前面的依旧会计算 System.out.println(""); } }
10
20
=============================================
30
1020
30