算术赋值运算符与自增自减运算符

1. 算数赋值运算符

i=i+1

i=i-1

i=i*1

i=i/1

int i1=2;
		int i2=3;
		int i3=5;
		int i4=7;
		int i5=9;
		//对这些变量进行算术运算符
		i1+=2;//4
		i2-=2;//1
		i3*=2;//10
		i4/=2;//3
		i5%=2;//1
		System.out.print(i1+"."+i2+"."+i3+"."+i4+","+i5);

2.自增自减运算符

        int i=5;
		System.out.println("i="+i);
		System.out.println("++i="+(++i));
		System.out.println("i="+i);
		System.out.println("i++="+(i++));
		System.out.println("i="+i);

 

你可能感兴趣的:(算术赋值运算符与自增自减运算符)