Missing value in Java

后端 未结 11 2766
慢半拍i
慢半拍i 2021-02-20 11:51

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;         


        
11条回答
  •  一向
    一向 (楼主)
    2021-02-20 12:17

    you can set income to null. Later, when you check value of income, if it is null, than treat it as missing

    Integer income = a>=53?pay_rate:null;
    

提交回复
热议问题