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

null

 
bill1111
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why isnt null a reserved word in java?
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is.
Please change your name to conform to JavaRanch's policy. We ask that you use your first and last name in these forums so that the site maintains a professional appearance (i.e., the high signal-low noise content one expects when people post with their real names). Thanks for your cooperation.
 
bill1111
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but it is not listed in Brodgen's Cram book.
I was too hurry to ask the question, sorry.
I could not modify the name in myprofile.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"null" is not a Keyword, but it is a reserved literal.
From the Java Language Specification

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):
Keyword: one of
abstract default if private this
boolean do implements protected throw
break double import public throws
byte else instanceof return transient
case extends int short try
catch final interface static void
char finally long strictfp volatile
class float native super while
const for new switch
continue goto package synchronized
The keywords const and goto are reserved, even though they are not currently used. This may allow a Java compiler to produce better error messages if these C++ keywords incorrectly appear in programs.
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).


and

3.10.7 The Null Literal
The null type has one value, the null reference, represented by the literal null, which is formed from ASCII characters. A null literal is always of the null type.
NullLiteral:
null

[ January 15, 2002: Message edited by: Cindy Glass ]
 
bill1111
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic