Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between += and =+?

What is the difference between += and =+? Specifically, in java, but in general also.

like image 481
Java Man Avatar asked May 30 '10 14:05

Java Man


People also ask

What is the difference between (;) and (:)?

Colons and semicolons are two types of punctuation. Colons (:) are used in sentences to show that something is following, like a quotation, example, or list. Semicolons (;) are used to join two independent clauses, or two complete thoughts that could stand alone as complete sentences.

What is the difference between () and []?

() is a tuple: An immutable collection of values, usually (but not necessarily) of different types. [] is a list: A mutable collection of values, usually (but not necessarily) of the same type.

Whats the difference between and ≥?

Greater than or equal to sign: ≥ This is because ≥ does not denote a strict inequality. This is the only difference between ">" and "≥".

What is the difference between >= and?

The first means all values greater (on the left) – but NOT including the value on the right. The second notation means that you also include the indicated value in the range.


1 Answers

i += 4;

means

i = i + 4;  // increase i by 4.

While

i =+ 4;

is equivalent to

i = +4;   // assign 4 to i. the unary plus is effectively no-op.

(See http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.15.3 for what a unary + does.)

like image 74
kennytm Avatar answered Sep 21 '22 19:09

kennytm