• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

So null, true and false are not keyword

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
RHE said true false and null are keywords but
jls say there are only boolean and null literals.
so if a question comes up "are true false and null literal?" the official answer is no.
just thought I'd double check.
I have to be sure.
Are there any other mistakes that anyone knows the RHE has made
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've seen a lot of confusion here about null, true, false etc.
and the reserved words/key words situation. I don't know if this has been posted previously, but I think this page at java.sun addresses it explicitly.
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jim,
Thanks, you just took us to the right place.....
true false and null are not keywords. They are reserved words/literals.. That's all... right..
Thanks

Amit
 
Kourosh Keshavarzi
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks both of you.
I think the key is the difference between keyword and reserved word.
But tell me if I'm reading more into what you're saying:
So null, true and false are just like goto and const where
you can't use them as identifiers(reserved) but they are not keywords.
Or can you use them as identifiers?
Now I'm confusing myself on the definition of keyword.
If a word is reserved like null and its used by java why isn't it a keyword.
If I can't use it and java is using it isn't it a keyword then?
 
Enthuware Software Support
Posts: 4907
60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This may help you...
http://enthuware.com/jqplus/FAJQuestions.html#TRUEFALSENULL
-Paul.

------------------
Get Certified, Guaranteed!
(Now Revised for the new Pattern)
www.enthuware.com/jqplus
 
Kourosh Keshavarzi
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks paul but can I trust that site
it says
Are true/false/null keywords?
For the purpose of SCJP2 you should treat them as Keywords.
Specifically, if you are given a list of words and are asked to pick Java Keywords then you SHOULD SELECT these also. Similarly, if you are given a list of words and are asked to pick valid java identifiers then you SHOULD NOT SELECT these.

S`o accordingto this I should think of them as keyword while taking the exam which is the opposite of what everybody is saying.
In the jawarski mock exam it has a question were it asked if null is a keyword. I put it is and got the question wrong.
I just hope I don't get this question on the exam.
Thank everyone
 
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm confused now, according to JLS http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#229308 it says they are keywords.
Any clarifications?
 
reply
    Bookmark Topic Watch Topic
  • New Topic