Multiple choice

Variables labeled …………….. are created when class is loaded and continue to exist for as long as the class is loaded.

  1. final

  2. static

  3. both (1) and (2)

  4. none of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Static variables are created when the class is loaded and persist as long as the class remains loaded. They're shared across all instances. Final variables are constants but can be instance or static. Only static has the class-lifetime behavior described in the question.