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 and reserved word 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 and reserved word" Watch "keywords and reserved word" New topic

keywords and reserved word

kapil munjal
Ranch Hand

Joined: May 11, 2004
Posts: 298

It is kind of a very beginner question, but could someone tell me the difference between the java reserved words and java keywords.


Kapil Munjal
SCJP 1.4, SCWCD 1.4
Shilpi M Ag
Ranch Hand

Joined: May 07, 2004
Posts: 40
see link

true false and null are not keywords but they are reserved. When asked in scjp we should not choose these three as reserved
Geoff Wass

Joined: Jun 10, 2004
Posts: 3
true false and null are represent literals (the first two are boolean literals, the third is assigned to objects), that is why they are reserved.

The keywords are actually "words" used by the Java language, that is why you can't use them as properties, class or method names.

Geoff Wass<br />Montr�al, Qu�bec, Canada
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Keywords are words that have a special meaning in Java. Things like "while" and "if" are keywords. Literals are words that represent a specific value, such as "true" and "false." Reserved words is the union of those two sets.

In short, reserved words are all of the Strings that you can't use for your own purposes (variable names, class names, etc.) For example, you can't have a variable named "while" or "false."

As far as the SCJP exam goes, you need not be able to differentiate between keywords and literals. You only need to know what words make up the set of reserved words (which consists of all of the keywords and all of the literals).

SCJP Tipline, etc.
N Rao

Joined: May 17, 2004
Posts: 14
1. 'true', 'false' and 'null' are called as "manifest constants". They are treated as reserved keywords but they are, practically, just reserved literals (that is, using which as identifiers would cause a compiler error!).

2. 'goto' and 'const' are reserved keywords but are not used.

However, the SCJP Exam Objectives/Pre-requisites quotes:
There will not be any questions regarding esoteric distinctions between keywords and manifest constants.

Hope this helps!

Good luck!

Work will teach you how to do it!<br />----------------------
kapil munjal
Ranch Hand

Joined: May 11, 2004
Posts: 298
Thanks a lot friends for your reply.

Actually I have never come across such type of distinction between keywords and reserved words, so I just wanted to know the difference.

I agree. Here's the link:
subject: keywords and reserved word
jQuery in Action, 3rd edition