What is the limitation of using the if statement? long longMaxValue;
if(longMaxValue >=9223372036854775807) { }
This would flag an error, stating that "integer number is too large" when the longMaxValue is declared type long.
But if I write it this way, it wouldn't flag an error: if(longMaxValue >= Long.MAX_VALUE) { }
Why?
[ July 17, 2005: Message edited by: Karen Baog ]
[ July 17, 2005: Message edited by: Karen Baog ] [ July 17, 2005: Message edited by: Karen Baog ]
amerzil co-ed student<br />"Praise be the Code"
Steve Simon Joseph Fernandez
Ranch Hand
Joined: Jul 17, 2005
Posts: 35
posted
0
Hi Karen,
You should postfix 'L' to the number to indicate that it's a long constant. I think by default, all numeric constants are taken by java as int unless otherwise specified. This works:
_steve.
Stuart Gray
Ranch Hand
Joined: Apr 21, 2005
Posts: 410
posted
0
The two numbers you posted are the same - the character at the end of the first one is a lowercase 'L', not a one, used to indicate the value is a long.
But to be absolutely sure of the value, why don't you just do this: