In addition to this +-*/% of these 5 arithmetic operators there are actually 2 + +-These two can also belong to the arithmetic operator. He is the self-increment of the decrement operation, for example: int i = 10; i++; I--or ++i-I but these 2 are more special, he has the first arithmetic and the later operation one says. + +--symbol in the back of the operation, + +--symbol in front of the first operation for example: i++ I-this for the post operation, ++i-I This is the first operation.
+ +--he is an abbreviated way, fused with the abbreviation of 2 lines of code.
For example: int i = 100; int a = i; i = i+1; Meaning, declare a I and declare a, I gave to a and I myself added 1 in this 2 sentence code he can be abbreviated into a sentence, can be such an int a = i++; i++ the meaning of this, this I original value first gave a, and then he added 1. 4.3 is shown below:
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160421/1f05bc65b3d4405f9a29733729c88956.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
Figure 4.3
He does not see any problems with his own self-increment, but if one but the other variables participate in the operation then the effect is different for example: int a = 10; int i; i = a++; I= ++a; He this a++ is after the operation, after the operation then first the value of a is given to I, and then a himself added a 1, he split into 2 sentences is actually this: i = A; A = a++. ++a is the first operation, the first operation is that he first operation +1 and then the value to I, he split into 2 sentences is actually written like this: a = a++; i = A;. 4.31 is shown below:
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160421/2574a1c4d0a14189a4f493d315e34164.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
Figure 4.31
Exercises: 1. Use int type operation: 100*100 2. Receive with int type, 1.5+9.5 3. Convert the Long value 10000000000 to int 4.double 10.5 to float type 5. To the value 80000, with the int type to receive, and subtract 100.9 6 with a double type. Self-increment self-reduction mental arithmetic exercise can not be calculated by the machine, by their own mental arithmetic 4.32:
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160421/2f0e3e7ef6bd4b2b8b882863758e8c81_th.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
Figure 4.32
Technology sharing: www.kaige123.com
This article is from the "11247808" blog, please be sure to keep this source http://11257808.blog.51cto.com/11247808/1890087
Java Increment Auto-decrement operator