That evening four students came to his door, seeking help with a truculent program. Its log files were overflowing with ArrayIndexOutOfBounds exceptions which the students insisted were impossible: the array in question was declared to hold a thousand elements, and the index — a one-byte integer — could never exceed 255 by definition.
Java master Bawan said: “The beggar in the marketplace owns nothing but empty cups. Fill all but one with tea and he will praise you; yet spill a drop into the last and he must instantly die of thirst. Explain.”
ubiquity: PS: This has been done before.
PS: This has been done before.
ibfrog: I think the lesson is you shouldn't count on the size of a variable to protect the value it can expand to.
Does Java have the ability to define the bit width of an integer?
Just because you think its a broom doesn't mean it can't be used to beat you.
« Older Andy Griffith Dies at 86. | Going to school in fifties' Britain Newer »
This thread has been archived and is closed to new comments