• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is "goto" a Java keyword?

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to know goto is a key word or reserved word.
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic