Adam Confino wrote:Paul,I'm not aware of any situations where the the value would be set to zero. Is there a safeguard you could create?
If you really want to know if it's been initialized, use Integer and not a primitive. Then, by definition, if the reference is null you'll know it hasn't been initialized. Using an int is problematic since your requirements may change and 0 may become a valid initial value. If for some reason you must use an int, I'd choose a better "uninitialized" value, like -1 (if the value must be a positive value) or Integer.MIN_VALUE.