user6446529
user6446529

Reputation:

Why was the 'const' keyword created in Java?

I have noticed that there is the const keyword in Java. It reminded me of things like static and final variables there.

But why was it created without anyone actually using it?

Upvotes: 3

Views: 2010

Answers (1)

user207421
user207421

Reputation: 310893

From the JLS #3.9:

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.

Upvotes: 11

Related Questions