=Vs = in Java

I am familiar with the = operator in Java. If it is executed as follows:

i = 2;

Is the same:

i = i 2;

But what is it =? It compiles well in Java, but as far as I know, it only assigns the expression on the right side of the result to the variable on the left Namely

i = 2

Is the same:

i = 2

Who knows what happened? If someone asks an apology, SEO for any questions about operators is always bad... Thank you!

Solution

I = 2 same as

i = +2;

That is, it is a unary operator

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>