Calculations

Using the "*" and "+" operators can return Overflow Run-Time Error.

link - stackoverflow.com/questions/17315650/overflow-when-multiplying-integers-and-assigning-to-long 

The literals 24, 60, and 60 are all of type Integer so by default, the * operator returns an Integer, which overflows because the result is greater than 32,767.


The literals 32767 and 1 are all of type Integer so by default, so the + operator returns an Integer, which overflows because the result is greater than 32,767.


The literal 32768 is a Long by default, so the * operator returns a Long, so there is no overflow.


© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext