char initial value in Java

前端 未结 6 1057
轮回少年
轮回少年 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:18

    Either you initialize the variable to something

    char retChar = 'x';
    

    or you leave it automatically initialized, which is

    char retChar = '\0';
    

    an ascii 0, the same as

    char retChar = (char) 0;
    

    What can one initialize char values to?

    Sounds undecided between automatic initialisation, which means, you have no influence, or explicit initialisation. But you cannot change the default.

提交回复
热议问题