Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

null

 
bobby chaurasia
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"null is not a keyword but a reserved word"
What's the difference between a keyword and a reserved word ? Are there any other reserved words ?
Thanks.
 
John Paverd
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bobby
Since everyone else is quoting from Kathy and Bert's new book today, I will too As you can see, in addition to explaining Java, the book provides a lot of information about the exam, and what will and won't be tested.
According to the Java Language Specification, null, true, and false are technically literal values (sometimes referred to as manifest constants) and not keywords. Just as with the other keywords, if you try to create an identifier with one of these literal values, you�ll get a compiler error. For the purposes of the exam, treat them just as you would the other reserved words. You will not be asked to differentiate between reserved words and these reserved literals

[ January 08, 2003: Message edited by: John Paverd ]
 
Kasi lingam
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by bobby chaurasia:
"null is not a keyword but a reserved word"
What's the difference between a keyword and a reserved word ? Are there any other reserved words ?
Thanks.

As Per Kathy Book, null,true,false are not keywords .They are called "Manifest Constant".
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kasi lingam:
As Per Kathy Book, null,true,false are not keywords .They are called "Manifest Constant".


Yes, but the more important message from Kathy's book is the following.
For the purposes of the exam, treat them just as you would the other reserved words. You will not be asked to differentiate between reserved words and these reserved literals.
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Notice that the JLS and the Java Programming Language do not classify words as "reserved words". They say keywords are reserved. They say true, false and null are literals.
Keywords are reserved character sequences and cannot be used as identifiers. You cannot use language keywords as identifiers because they have special meaning within the language.
literals are the source code representation of values of a type. true, false and null are literals. You cannot use true, false or null as identifiers just as you cannot use 12 as an identifier.
[ April 06, 2003: Message edited by: Marlene Miller ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic