A constant variable is a final variable of primitive type or type String that is initialized with a constant expression (§15.29).
I think that confirms you are correct. I checked the errata and it would not appear to have been reported before.
The exam will probably use the term from the JLS, “constant variable,” rather than, “compile‑time constant,” even though the English Language Police will issue a $1000 fixed penalty notice to anybody they catch saying, “constant variable”
Thanks for the clarification. I think more people would read the JLS if it contained more jokes ;) I'm seriously hoping the exam won't be this pedantic. In this particular case I couldn't get my head around the 'why' inner classes can't have static members but I've settled for 'because we said so, that's why'.
There are places in Java where each notion of "constant" is relevant, both 'known at compile time' and the less strong "doesn't change in its scope once it is set".
C# has two different keywords for the two concepts, const and readonly, whereas in Java one word, final, (borrowed from C++ const which appears nowhere in Java except reserved-words-never-used) does double duty.
There are three concepts of 'final' or constant in Java.
1. The strongest, a compile-time constant, needed for places like case values in switch statements, among others.
2. final -- meaning just that it doesn't change again after it is set, but perhaps with a value known only at runtime.
3. Effectively final local variable (which always means that it is NOT marked final), but can be referenced in a lambda or anonymous class.
At least every compile time constant will also be final, tho literals themselves aren't marked as such.
final local variables are not considered 'effectively final'.
The exams are pedantic enough that this matters.
There are places where something needs to be final or effectively final, but despite that final variables are NOT considered "effectively final", a distinction that seems to be splitting hairs but can appear on both mock and real exam questions. At least they are consistent on this point which seems meaningless to me.