aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Is Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Is "goto"  a Java keyword?" Watch "Is "goto"  a Java keyword?" New topic
Author

Is "goto" a Java keyword?

Bin Zhao
Ranch Hand

Joined: Oct 04, 2000
Posts: 73
I want to know goto is a key word or reserved word.
Suresh Selvaraj
Ranch Hand

Joined: Nov 14, 2000
Posts: 104
Hi,
"goto" and "const" are reserved words and are not currently used.
Note: "true" , "false" and "null" are also reserved words and not keywords.


Suresh Selvaraj, (author of JQuiz)<br />SCJP2<br /><a href="http://www.decontconsulting.com" target="_blank" rel="nofollow">www.decontconsulting.com</a>
Aru Ven
Ranch Hand

Joined: Sep 28, 2000
Posts: 199
Bin,
When asked to pick up the keywords.... u need to pick up even the reserved words also.....( from SCJP point of view).
Aruna
Suresh Selvaraj
Ranch Hand

Joined: Nov 14, 2000
Posts: 104
Hi Bin,
You may refer the URL mentioned below for a complete list of all the Java Keywords and Reserved words.
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html
- Suresh Selvaraj
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
The key here is "keywords" and "reserved words" All keywords are reserved words and you cannot use them as method, class, or variable names.
There are 3 other words, null, true, and false, which are not keywords, but are still reserved words. true and false are boolean literals and null is a null literal.
There are also 2 words that are keywords but are not used in Java and that is goto and const.
So the final answer is yes, goto is a keyword.
Bill
[This message has been edited by bill bozeman (edited November 22, 2000).]
Anuj Anand
Ranch Hand

Joined: Nov 18, 2000
Posts: 96
I don't agree with you that for SJCP goto should be written as a keyword .It is a reserved word and the other reserved words are 'const' 'true' 'false' . So basically all keywords are reserved words and all reserved words may or maynot be keywords and goto is not...
Oliver Grass
Ranch Hand

Joined: Nov 02, 2000
Posts: 65
Sorry,
but bill is right....
Look at the JLS, chapter 3.9....
Keywords: one of.... const .... goto...
Every keyword is a reserved word, including const and goto (this has nothing to do if they are used or not, they are keywords).
Reserved word are mostly keywords, BUT there are some, which are NOT keywords BUT reserved...
These are the boolean literals true and false and the null literal...
hope that helps
Oliver
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is "goto" a Java keyword?