Difference between + and +=

Viewed 34

I Have:

Byte a = 100;
a = (Byte) a + 200;

OR

Byte a = 100;
a += 200;

In the first version I need a cast (because +operator returns int). But no cast needed in second expression allthough += returns int too.

Why is it that in the second example casting is done automatically?

0 Answers
Related