What is the statement that can be used in Java to represent a missing value of a variable. for instance I want to write a code:
if (a>=23)
income = pay_rate;
As mentioned in other ans here, you can use a boxed type. But I ll recommend look for the valid values for your data and choose any invalid value for missing. In your specific case of income, which cannot be negative, so you can choose -1.
The reason to avoid boxed type is performance. I am not against using them but if you can work without them then there is no need to use them.
For the cases where most of +ve and -ve values are valid values, use eitherInteger.MAX_VALUE
or Integer.MIN_VALUE
as your missing value. You ll just loose one value of all the available value range.
NOTE: Auto-boxing (converting implicitly from primitive to boxed type and vice-versa) is a good feature but can lead to some performance issues which are difficult to debug and find.