File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Keyword

 
lalitha kaparapu
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 159
C++ Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes it is. you should try this stuff instead of asking.
 
Oggi Olli
Ranch Hand
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 513
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic