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?

  1. A.

    Garbage value

  2. B.

    Compiler Error

  3. C.

    Null

  4. D.

    0

Attempted by 74 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.

Explore the full course: Rssb Senior Computer Instructor