I recently learned, while converting some Java code to C#, that Java's increment operator '+=' implicitly casts to the type of LHS:
int i = 5;
long lng = 0xffffffffffffL; //larger than Int.MAX_VALUE
i += lng; //allowed by Java (i==4), rejected by C#
is equivalent to: (details here)
int i = 0;
long lng = 0xffffffffffffL;
i = (int)(i + lng);
thus silently causing the opportunity for loss of magnitude.
C# is more conscientious about this at compile-time:
Cannot convert source type long to target type int.
Are there other similar situations allowed by Java?