char initial value in Java

前端 未结 6 1056
轮回少年
轮回少年 2020-12-08 19:21

You initialize an int variable defined within a method to have a value of 0 until you compute specific values for the int. What can on

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-08 20:04

    As you will see in linked discussion there is no need for initializing char with special character as it's done for us and is represented by '\u0000' character code.

    So if we want simply to check if specified char was initialized just write:

    if(charVariable != '\u0000'){
     actionsOnInitializedCharacter();
    }
    

    Link to question: what's the default value of char?

提交回复
热议问题