This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes IMP!- can, boolean literals (true, etc),unused reserved words,BE CALLED Keywords ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "IMP!- can, boolean literals (true, etc),unused reserved words,BE CALLED Keywords ?" Watch "IMP!- can, boolean literals (true, etc),unused reserved words,BE CALLED Keywords ?" New topic
Author

IMP!- can, boolean literals (true, etc),unused reserved words,BE CALLED Keywords ?

sarim raza
Ranch Hand

Joined: Nov 02, 2000
Posts: 232
examples include;
boolean literals: true false null
unused reserved :goto const cast byvalue outer inner operator generic future rest var

ARE THESE KEYWORDS, CAN THEY BE CALLED KEYWORDS ???
Warren Bell
Ranch Hand

Joined: Dec 20, 2000
Posts: 56
true and false are keywords True and False are not.
public class True // Will compile and print 11
{
public static void main(String[] args)
{
int True = 11;
System.out.println(True);
}
}
public class True // Will not compile
{
public static void main(String[] args)
{
int true = 11;
System.out.println(true);
}
}
------------------
Warren Bell


Warren Bell
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Sarim,
JLS §3.9 describes const and goto as being reserved as keywords.
true and false are boolean literals; they are not keywords BUT cannot be used as identifiers. The same goes for null which is also a literal.
The other words you listed are not keywords. Nor have I come across any mention of their being reserved. Try using them as identifier names; if the code compiles, they're not reserved.
Hope that helps.
------------------
Jane
The cure for boredom is curiosity.
There is no cure for curiosity.
-- Dorothy Parker


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Tom Tang
Ranch Hand

Joined: Dec 24, 2000
Posts: 133
Hi, Jane:
Is there any difference between Java keywords and Java reserved words? I saw at least two books list true and false as java keywords.


Sun Certified Java Programmer
Cherry Mathew
Ranch Hand

Joined: Dec 26, 2000
Posts: 159
what if they ask the question what r java keywords and give
options
true
null
goto
const
etc shud we select these ?
please answer this question
Anand Yadav
Greenhorn

Joined: Dec 28, 2000
Posts: 5
Dear Mathew
In case of questions asked in JCP with the above given options
you should only mark the following ones except ( true & false & null ) they are literals .

goto
const
[This message has been edited by Anand Yadav (edited December 30, 2000).]
[This message has been edited by Anand Yadav (edited December 30, 2000).]


Anand
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Tom,
When you have any doubts about which words are keywords, check the JLS§3.9. The words listed are the only keywords for Java.
It also explains that goto and const are considered keywords; even though they are not currently used by the language and that true, false, and null are literals, not keywords, but, like keywords, they may not be used as identifiers ie variable, method, etc names.
I have never seen any references to reserved words in the literature although I have seen it used on mocks. For exam purposes ... stick to the definitions given in the JLS.
Hope that helps.
------------------
Jane
The cure for boredom is curiosity.
There is no cure for curiosity.
-- Dorothy Parker
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IMP!- can, boolean literals (true, etc),unused reserved words,BE CALLED Keywords ?