aspose file tools
The moose likes Java in General and the fly likes unused keyword Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Java » Java in General
Bookmark "unused keyword" Watch "unused keyword" New topic

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.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14589

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 8 API documentation
Ilja Preuss

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