| Author |
Keyword
|
lalitha kaparapu
Greenhorn
Joined: Nov 05, 2007
Posts: 16
|
|
I have one doubt regarding keywords.In one of the mock exam I observed that "true" is not a keyword.I have searched in K & B book also,there it does'nt list true as a keyword. I have another doubt.Is this acceptible Boolean flag=true;
|
 |
Mark Uppeteer
Ranch Hand
Joined: Mar 02, 2004
Posts: 159
|
|
|
yes it is. you should try this stuff instead of asking.
|
I know where my towel is. (SCJP 5, OCPJWCD)
[Free Quiz Tips for a fun night with friends or family] Flash games
|
 |
Oggi Olli
Ranch Hand
Joined: Oct 11, 2007
Posts: 83
|
|
true, false, and null might seem like keywords, but they are actually literals; you cannot use them as identifiers in your programs.
web page
|
 |
Kelvin Chenhao Lim
Ranch Hand
Joined: Oct 20, 2007
Posts: 513
|
|
As Steinar already pointed out, true and false are boolean literals, not keywords. Similarly, null is also a special literal, known as the (surprise!) "null literal". Despite their lexical structure, you should think of them in the same way as other literals like 42, -.287f, and "Hello, World!". However, this restriction is really just a technical detail that's important only to people who work on parsers and conceptualize Java grammar rules. For all practical purposes, the restrictions on what you can do with true and false are the same as the restrictions for keywords. [ November 15, 2007: Message edited by: Kelvin Lim ]
|
SCJP 5.0
|
 |
 |
|
|
subject: Keyword
|
|
|