File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Reserved Words vs Keywords Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Reserved Words vs Keywords" Watch "Reserved Words vs Keywords" New topic
Author

Reserved Words vs Keywords

Brian, Cavanagh
Ranch Hand

Joined: Oct 30, 2000
Posts: 70
Hi all,
Could anyone tell me where I can find a reference to what are reserved words and what are keywords?
Cheers,
Brian
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
These links might help you -
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html
http://java.sun.com/docs/books/jls/html/3.doc.html#229308
------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Brian, Cavanagh
Ranch Hand

Joined: Oct 30, 2000
Posts: 70
Great thanks Ajith
Brian, Cavanagh
Ranch Hand

Joined: Oct 30, 2000
Posts: 70
Ajith,
one further question on this topic. Some questions I have seen have asked if a given list are keywords, and it has marked some of my answers as wrong stating that they are reserved words, not keywords.
Out of the list, are only const & goto the only reserved words in the list.
Thx in advance
------------------
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Some mock exams considers literals are reserved words, which I think is wrong.
null - is a null literal.
true/false are boolean literals.
These should not be mistaken for reserved words.

------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
Gazala Bohra
Greenhorn

Joined: Oct 27, 2000
Posts: 27
Hi!
I used the link that Ajith had given and while reading this a doubt came into my mind.Can someone please enlighten me on this.It says:
"These words(i.e Keywords) are reserved--you cannot use any of these words as names in your Java programs. true, false, and null are not keywords but they are reserved words, so you cannot use them as names in your programs either."
Now my doubt is that functionally what is the difference between keywords and reserved words? We can't use either of them as names of identifiers in our programs, that is understood but what is it that distinguishes a keyword from a reserved word?Am I right in thinking that keywords are used by compilers to perform specific actions while compiling codes while it is not so with reserved words.Waiting for someone to confirm.
Thanks
Gazala.
Sandeep Meher
Greenhorn

Joined: Jan 24, 2001
Posts: 5
Hi,
1. According to the Sun's Java tutorial:
a. reserved words = keywords (including goto and const) + the literals null, true, false
2. According to the Java Language Specification:
a. keywords (include goto and const) are reserved
b. null, true, false are not keywords but literals
Regards,
Sandeep.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reserved Words vs Keywords