File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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
"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="" target="_blank" rel="nofollow"></a>
Aru Ven
Ranch Hand

Joined: Sep 28, 2000
Posts: 199
When asked to pick up the keywords.... u need to pick up even the reserved words also.....( from SCJP point of view).
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.
- 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.
[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
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
I agree. Here's the link:
subject: Is "goto" a Java keyword?
It's not a secret anymore!