Skip to content
Advertisement

Tag: integer-overflow

Overflow occurs with multiplication

The above code creates overflow and doesn’t print the correct result. The above 2 lines print the correct result. My questions are- Does it matter to the compiler which I use, m2 or m3? How does java starts multiplying? Left to right or right to left? Does 24*60 gets computed first or 1000*1000? Answer I would use the m2 line

Advertisement