Java Boolean Default Value | Generated by AI

Home 2025.12

Question: What is the default value of a boolean instance variable in a class?

Answer:

In Java, instance variables (fields) of a class that are not explicitly initialized are automatically assigned default values based on their type.

For primitive types:

Therefore, the default value of a boolean instance variable is false.

The correct answer is B. false.

Note: This applies to instance variables and static variables. Local variables (declared inside methods) do not have default values and must be explicitly initialized before use.

References:


Back

x-ai/grok-4.1-fast

Donate