Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is "goto" a Java keyword?

 
Bin Zhao
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to know goto is a key word or reserved word.
 
Suresh Selvaraj
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
"goto" and "const" are reserved words and are not currently used.
Note: "true" , "false" and "null" are also reserved words and not keywords.
 
Aru Ven
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic