Missing value in Java

后端 未结 11 2750
慢半拍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:19

    Use throws:

    if (a>=23)
        income = pay_rate;
    else 
        throw new IllegalArgumentException("income is missing");
    

提交回复
热议问题