What is the default value of a double variable in Java if it's not explicitly initialized?
A. 0
B. 1
C. -1
D. Null
Answer: Option A
Solution (By Examveda Team)
The correct answer is Option A: 0.In Java, the default value of a double variable is 0.0 if it's not explicitly initialized.
Here's the breakdown:
Option A: 0 - This is the correct default value for an uninitialized double variable in Java. It represents the numeric value zero.
Option B: 1 - This is not the default value for a double variable. The default is 0.0, not 1.0.
Option C: -1 - This is not the default value for a double variable. The default is 0.0, not -1.0.
Option D: Null - Null is not a valid value for a double variable. Java uses 0.0 as the default value for uninitialized double variables.
So, the default value of a double variable in Java if it's not explicitly initialized is 0.0.
Related Questions on Data Types and Variables
Which of the following is not a valid identifier for a Java variable?
A. my_var
B. _myVar
C. 3rdVar
D. $var

Join The Discussion