File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Keyword Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Keyword" Watch "Keyword" New topic
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Keyword
 
Similar Threads
Whizlab 1.4 certf kit Question
Intersting Question 4 U
Querying All Fields
True, false and null = keyword or identifier?
How to use the keyword for searching?