?
What is the default value of a boolean variable in Java if it's not explicitly initialized?
Answer & Solution
Correct Answer:
Option
A
The correct answer is Option A: FALSE.
In Java, the default value of a boolean variable is FALSE if it's not explicitly initialized.
Here's the breakdown:
Option A: FALSE - This is the correct default value for an uninitialized boolean variable in Java. It represents a false boolean value.
Option B: TRUE - This is not the default value. The default value for a boolean is FALSE.
Option C: 0 - This is not the default value for a boolean in Java. 0 is typically used for integer values.
Option D: Null - Null is not a valid value for a boolean variable. Java boolean variables can only be true or false.
So, the default value of a boolean variable in Java if it's not explicitly initialized is FALSE.
In Java, the default value of a boolean variable is FALSE if it's not explicitly initialized.
Here's the breakdown:
Option A: FALSE - This is the correct default value for an uninitialized boolean variable in Java. It represents a false boolean value.
Option B: TRUE - This is not the default value. The default value for a boolean is FALSE.
Option C: 0 - This is not the default value for a boolean in Java. 0 is typically used for integer values.
Option D: Null - Null is not a valid value for a boolean variable. Java boolean variables can only be true or false.
So, the default value of a boolean variable in Java if it's not explicitly initialized is FALSE.
Join the Discussion
Login to post a comment or share your explanation.
Login