File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes keywords or reserved words? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "keywords or reserved words?" Watch "keywords or reserved words?" New topic

keywords or reserved words?

dx wu
Ranch Hand

Joined: Apr 28, 2002
Posts: 60
could someone tell me what's the difference of keywords and reserved words? and true,false,null are reserved words or keywords?

good good study , day day up!
Netty poestel
Ranch Hand

Joined: Sep 20, 2004
Posts: 131
reserved words are reserved and not currently used e.g "goto" , "const"
so something maybe for the future (?!)

true /flase/null are certainly not Java they fall outside this set...and afaik....the exam doesn't indulge in this paradigm...

Phew.. one worry less
janne s
Ranch Hand

Joined: Sep 21, 2004
Posts: 81

check this link on keywords 'n' reserved words

Jay Pawar
Ranch Hand

Joined: Aug 27, 2004
Posts: 411
Just FYI... the link you provided doesn't have ASSERT keyword, which is important as far as the exam is concerned.

Cheers,<br />Jay<br /> <br />(SCJP 1.4)<br />Heights of great men were not achieved in one day, they were toiling day and night while their companions slept.
Louie van Bommel
Ranch Hand

Joined: Aug 17, 2004
Posts: 76
Quote from Sun:
Section 4: Language Fundamentals
Identify all Java programming language keywords. Note: There will not be any questions regarding esoteric distinctions between keywords and manifest constants.

Now for something useful: On the exam look for words such as
instanceOf, sizeof friend virtual include
which look like they might be Java reserved words, but they are not.

The Java Language Specification refers to 49 words (yes I know jls2 had only 48 because "assert" was not there) as Keywords.

The 52 words of interest (which include null, true, false) are NOT allowed to be used as identifiers in Java.

Quote from JLS Second Edition:

3.9 Keywords
The following character sequences, formed from ASCII letters, are reserved for use as keywords and cannot be used as identifiers (�3.8):

[all words that we are interested in except for null true false omitted for brevity]...

The keywords const and goto are reserved, even though they are not currently used. ...

While true and false might appear to be keywords, they are technically Boolean literals (�3.10.3). Similarly, while null might appear to be a keyword, it is technically the null literal (�3.10.7).

[ October 01, 2004: Message edited by: Louie van Bommel ]
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
The key point to remember from Louie's post is that you don't need to know the difference between keywords and reserved words for the exam. You just need to know which words are reserved and can't be used as identifiers.

So, even though "for" is a keyword and "true" is a literal, you only need to know that neither one is allowed as an identifier.

SCJP Tipline, etc.
dx wu
Ranch Hand

Joined: Apr 28, 2002
Posts: 60
thanks very much
I agree. Here's the link:
subject: keywords or reserved words?
It's not a secret anymore!