char initial value in Java

Typically for local variables I initialize them as late as I can. It’s rare that I need a “dummy” value. However, if you do, you can use any value you like – it won’t make any difference, if you’re sure you’re going to assign a value before reading it.

If you want the char equivalent of 0, it’s just Unicode 0, which can be written as

That’s also the default value for an instance (or static) variable of type char.

Leave a Comment