Search code examples
javabooleanprimitive

What is the third boolean state in java?


While I know that by definition a boolean consists of only two states, true or false. I was wondering what value does a boolean have before it is initialized with one of these states.


Solution

  • It defaults to false.

    Edit: By popular demand:

    unless you're using the wrapped Boolean, which defaults to null. – sudhir.j