• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

need clarification about true, false and null

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I read in "Java 2 The complete Reference" that java reserves true, false and null
If I am right these are the values defined by java and these words may not be used for variable,class or method names.so can we consider them as keywords?
thanks
bani
 
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, they're actually reserved literals. A literal is a constant, like 'x', 42 or 3.14159
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are not keywords, they are literals. Things like "if" and "for" are keywords. "true" and "null" are literals just like 1 and 7.5 are.
Corey
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This topic has been discussed plenty of time. Please, see the following (almost) exhaustive discussions:
https://coderanch.com/t/236312/java-programmer-SCJP/certification/null-java-keywork-or-not
https://coderanch.com/t/236527/java-programmer-SCJP/certification/Keywords
https://coderanch.com/t/234580/java-programmer-SCJP/certification/true-false-null-keywords
etc, etc...
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They act like keywords. But for the exam, you must not consider them as keywords. If a question
ask you whether they are keywords, answer NO.
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Alan Chong:
They act like keywords. But for the exam, you must not consider them as keywords. If a question
ask you whether they are keywords, answer NO.


I don't believe you'll have to make the distinction between keywords and literals on this exam. As far as I know, this is beyond the scope of the exam.
Corey
reply
    Bookmark Topic Watch Topic
  • New Topic