If I have the following code:
long interval = 0;
interval = ((6000 * 60) * 24) * 30;
It will not work, because I will need to make each literal long. So this will work:
interval = ((6000L * 60L) * 24L) * 30L;
But what if I try to propagate different variables of type char? Say I have:
char a, b, c, d;
And I give each of these characters a numerical value, so I try:
interval = a * b * c * d;
If this is an overflow, I cannot just put L because it will call different variables.
interval = aL * bL * cL * dL;
I tried to convert each of these characters long before the hand, but the product still returns a negative number.
source
share