To find out the real reason why goto
and const
were originally reserved, you would need to ask the Java language designers. The decision would have been made when the language was called Oak.
How ever there are a couple of plausible explanations:
They thought they might need to extend the language in a way that might be use these keywords, and they were keeping their options open.
They wanted to avoid cognitive dissonance for C/C++ programmers reading Java code where some misguided person decided to use "goto" or "const" as a variable or method name.
But the plain fact is that there is zero chance that these reserved words will ever be used now.
UPDATE
Apparently Java did have goto at one point.
"One of the things I did was there were some issues with goto. Java had a goto at one point. I did this study of what people were doing with goto? And based on that study of a half million lines of code, I just got rid of it."
From "James Gosling on Java, May 2001".
So the real explanation is that goto
is reserved because it was used in early versions of Java, and they decided to get rid of it.