M
mark.oliveira
Hi all,
I am dumbfounded... I have the following code:
long product = 1000;
product = product*60;
product = product*60;
product = product*24;
product = product*30;
product = product*3;
long product2 = (1000*60*60*24*30*3);
System.out.println("product: " + product);
System.out.println("product2: " + product2);
which produces the following result:
product: 7776000000
product2: -813934592
Can anyone please explain this behavior?? Am I wrong to expect the same
value for both product and product2? If so I would really like to know
why. Any insight will be very much appreciated.
Thanks,
Mark
I am dumbfounded... I have the following code:
long product = 1000;
product = product*60;
product = product*60;
product = product*24;
product = product*30;
product = product*3;
long product2 = (1000*60*60*24*30*3);
System.out.println("product: " + product);
System.out.println("product2: " + product2);
which produces the following result:
product: 7776000000
product2: -813934592
Can anyone please explain this behavior?? Am I wrong to expect the same
value for both product and product2? If so I would really like to know
why. Any insight will be very much appreciated.
Thanks,
Mark