aspose file tools*
The moose likes Java in General and the fly likes null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "null" Watch "null" New topic
Author

null

bill1111
Greenhorn

Joined: Jan 15, 2002
Posts: 5
why isnt null a reserved word in java?
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

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.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
bill1111
Greenhorn

Joined: Jan 15, 2002
Posts: 5
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

Joined: Sep 29, 2000
Posts: 8521
"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 ]

"JavaRanch, where the deer and the Certified play" - David O'Meara
bill1111
Greenhorn

Joined: Jan 15, 2002
Posts: 5
thanks
 
 
subject: null