Search code examples
javastandardskeyword

What's the aim of not used java keyword?


As oracle states, const is a keyword in java. But it is not used. So why is it so and what's the use of const being a non used keyword in java? (the same goes for goto)


Solution

  • From the Java Language Specification:

    The keywords const and goto are reserved, even though they are not currently used. This may allow a Java compiler to produce better error messages if these C++ keywords incorrectly appear in programs.

    (This wording already was in the first edition, I think.)