Checking the “boolean” result of an “int” type

前端 未结 8 1520
死守一世寂寞
死守一世寂寞 2020-12-10 23:43

I\'m learning Java, coming from C and I found an interesting difference between languages with the boolean type. In C there is no bool/ean

8条回答
  •  轮回少年
    2020-12-11 00:13

    FROM JLS:

    The boolean type has two values, represented by the boolean literals true and false, formed from ASCII letters.

    Thus no is the answer. the only was is

    if ( i != 0 )
    

提交回复
热议问题