• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

unused keyword  RSS feed

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why the unused reserved words goto,const are not used?
 
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Java Cowboy
Sheriff
Posts: 16084
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There purpose of const was to create constant value  which we could use Final
goto have done a lote of problem in other language so the people in java just want worry about using it so they leave it (I think so)
 
Saloon Keeper
Posts: 935
32
Eclipse IDE Hibernate jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahmed Youssef,
Welcome to CodeRanch!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!