2 ms·
<pedantry>There are no uninitialized values in Java. Reference values are initialized to null by default.</pedantry> I'm not sure how null makes your problem
by dkarl 18y ago
<pedantry>There are no uninitialized values in Java. Reference values are initialized to null by default.</pedantry>
I'm not sure how null makes your problem worse...? If you want a value meaning "this value hasn't been set by the program yet" then you'll have to specify a value for that purpose. The easiest thing is to just use null... unless null corresponds to a valid value for the type, in which case it seems fortunate that it's available to represent that value. I find null annoying when it doesn't correspond to any valid value for my type and I'm forced to check for it everywhere anyway.