• 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

Reserved Words or Keywords

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Which of the following are java reserved words?

1) if
2) then
3) goto
4) while
5) case

I thought that 1,3,4 and 5 are Java keywords and reserved words would be only true, false and null. Solution says 1,3,4 and 5 are Java reserved words. Whats the difference between Java reserved words and keywords ?

Sandeep
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's what the JLS has to say about keywords, reserved words and literals.

The question is worded in a a somewhat sloppy way. I have seen terms like "keywords" (if, while, case, ...), "reserved keywords" (goto const), "reserved literals" (null, false, true) used.

I think it's true to say that, in the exam, it will be very clear what to choose. It's important to realize what words are used in java, and what words are used in similar languages like C and C++ and do not appear in java.
[ May 17, 2004: Message edited by: Barry Gaunt ]
 
I am not young enough to know everything. - Oscar Wilde This tiny ad thinks it knows more than Oscar:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic