1. 基本的赋值运算符: =
int a = 3;
把 = 右边的数据赋值给左边
左边必须变量
2.扩展的赋值运算符:+=,-=,*=,/=,%=
+= 把左边和右边做加法,然后赋值给左边
案例1:
public class Demo1{ public static void main (String []args ){ int a =3;//把右边的常量值赋值给左边的变量,左边必须是变量 a += 4;//把左右两边相加的结果,赋值给左边 System.out.println(a); } }