In Java, what is the default value of an uninitialised static variable of type…
2025
In Java, what is the default value of an uninitialised static variable of type int declared in a class?
Answer: D. 0 — In Java, static variables belong to the class and are automatically initialized by the JVM. Primitive numeric types such as int receive a default value of 0…
- A.
Garbage value
- B.
Compiler Error
- C.
Null
- D.
0
Attempted by 241 students.
Show answer & explanation
Correct answer: D
In Java, static variables belong to the class and are automatically initialized by the JVM. Primitive numeric types such as int receive a default value of 0 if not explicitly initialized.
Loading lesson…