• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Keyword vs Reserved word!

 
sabyasachi mondal
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If anyone can help me understand the distinction between java keywords and java reserved words.
Are true, false and null reserved or keywords? There might be more like these. I found from a resource (jwroxki mock) that null is not a keyword. But Sun book (Core Java2) put this word in the keyword series - page 698 (V1 by Horstman & Cornell).

Thanks for your time.
regds
mondal
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The terms "keyword" and "reserved word" may not be synonymous to some, but in practice they amount to the same thing: you cannot use these words as identifiers in your code.
All keywords are reserved words that perform a special function in the language. Since <code>true</code>, <code>false</code>, and <code>null</code> don't do anything -- they're "merely" pre-defined values -- some people don't consider them keywords. Ok, sure, fine.
There's another subset that for my money is more interesting: the words <code]goto></code>, <code>const</code>, and <code>byvalue</code> can't be used either. They do nothing at all! They have no function, no value, and can't be identifiers. I assume these words were stricken from the language because they represent features in C/C++ that Java does not allow.
-----------------
Michael Ernest, co-author of:The Complete Java 2 Certification Study Guide
[This message has been edited by Michael Ernest (edited January 13, 2001).]
 
sabyasachi mondal
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Michael Ernest:
The terms "keyword" and "reserved word" may not be synonymous to some, but in practice they amount to the same thing: you cannot use these words as identifiers in your code.
All keywords are reserved words that perform a special function in the language. Since <code>true</code>, <code>false</code>, and <code>null</code> don't do anything -- they're "merely" pre-defined values -- some people don't consider them keywords. Ok, sure, fine.
There's another subset that for my money is more interesting: the words <code]goto></code>, <code>const</code>, and <code>byvalue</code> can't be used either. They do nothing at all! They have no function, no value, and can't be identifiers. I assume these words were stricken from the language because they represent features in C/C++ that Java does not allow.
-----------------
Michael Ernest, co-author of:The Complete Java 2 Certification Study Guide
[This message has been edited by Michael Ernest (edited January 13, 2001).]

Thank you Michael. So I would consider them not as java keywords in the jexam.
Thanks also for providing the URL of your java book.
regds,
mondal

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic