| Author |
unused keyword
|
Arun Prasath
Ranch Hand
Joined: Jul 18, 2006
Posts: 60
|
|
|
Why the unused reserved words goto,const are not used?
|
 |
Peter Chase
Ranch Hand
Joined: Oct 30, 2001
Posts: 1970
|
|
|
Maybe the language designers were reserving keywords for features they thought they might add later, but didn't. Shame they didn't reserve "assert" and "enum", which they really did add later.
|
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
The Java programming language was based largely on the languages C and C++. The keywords "goto" and "const" came from C and C++. For some reason, the designers of the Java language decided to make those words "reserved words", but didn't implement them in the language. Note that using "goto" is considered bad practice in C and C++, so that's most likely the reason why it isn't implemented in Java. I don't know why "const" isn't implemented in Java. We have "final", which is somewhat like "const" in C and C++ (although not exactly the same).
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
|
|
|
As far as I know, they never planned to ever use those reserved words. They made them reserved because using them in your code could lead to some confusion for developers coming from a C background, I think.
|
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
|
 |
 |
|
|
subject: unused keyword
|
|
|