• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Key Words

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone please explain that in case a questions is there that which of these are keywords
1) true
2) false
3) null
Are these keywords or not.
Thanks
Mahesh
 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes they are keywords.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I thing true, false and null are not keywords.
They are literals.
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mahesh,
true and false are boolean literals
null is a null literal
While they are not, technically, keywords, you cannot use them as identifier names ie you can't name a variable, method or class true, false or null.
Hope that helps.
------------------
Jane Griscti
Sun Certified Java 2 Programmer
"When ideas fail, words come in very handy" -- Goethe
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does the real test ask you to differentiate keywords from reserved words? What is the rule to differentiate those two?
Thanks
--Howard
 
Ishaan Mohan
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes All threee are Literals but from Exam point of view I think If question is select Keywords and options are :
a) true
b) false
c) string
d) short
e) null
then answer will be a,b,d and e.
(all mocks exams are considering them as a keywords.)
 
Ranch Hand
Posts: 3143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you have a question it is worth looking at the Programmer Certification FAQ to see if it has been answered you can find that here http://www.javaranch.com/certfaq.jsp#q1 ... if it's not there it's also worth doing a search using a key word from you question to see what you can find. http://www.javaranch.com/cgi-bin/ubb/search.cgi?action=intro&default=24
 
Mahesh Bansal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But my question still remains answered. Whether in the exam if literals are given and question is are these keywords ?
Should we say true or false.
Thanks for the advice.
Mahesh
 
Jane Griscti
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mahesh,
The best approach to take is to watch the wording of the question. If it says "what words cannot be used as identifiers" and the answer list includes true, false, null or any keyword then you would select them.
If the question asks "which are not Java keywords" and the answer list includes true, false or null, I would select them as not being keywords.
If the question asks "which words are reserved in Java"; select any keywords and true, false or null if they are listed.
The exam questions on keywords tend to include captialized words or C words (they're always trying to catch out C coders) so I don't think the real questions will cause you much anxiety.
Hope that helps.
------------------
Jane Griscti
Sun Certified Java 2 Programmer
"When ideas fail, words come in very handy" -- Goethe
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
According to RHE ....
"true","false","null" r all keywords.
Ratul Banerjee
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
1. According to the Sun's Java tutorial:
a. reserved words = keywords (including goto and const) + the literals null, true, false
2. According to the Java Language Specification:
a. keywords (include goto and const) are reserved
b. null, true, false are not keywords but literals
Regards,
Sandeep.
 
Mahesh Bansal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for clearing the doubts.
Mahesh
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic