Multiple choice

Which of following constant declarations is valid?

  1. public static final void foo;

  2. public static final int USERS = 20;

  3. public FINAL SIZE = 10;

  4. public static boolean final BORED = TRUE;

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

A valid constant declaration in Java requires a visibility modifier, the static and final keywords, a data type, an identifier, and an initial value. Option B correctly follows this structure: 'public static final int USERS = 20;'. Option D is incorrect because 'final' must precede the data type, and 'TRUE' is not a valid boolean literal.