Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?


1 Answers

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.

like image 168
user207421 Avatar answered Dec 08 '25 15:12

user207421