Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "keywords and reserved word" Watch "keywords and reserved word" New topic
Author

keywords and reserved word

kapil munjal
Ranch Hand

Joined: May 11, 2004
Posts: 298
Hi,

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

Thanks
Kaps


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

Joined: May 07, 2004
Posts: 40
see link http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html

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
Greenhorn

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
Greenhorn

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!
-Rao


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.

Thanks
Kaps
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: keywords and reserved word
 
Similar Threads
Reserved words vs. keywords
keywords vs. reserved words
Please is null,true & false keywords
keywords
Jai Question : 4 on keywords