This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes legal java identifiers versus not a keyword/reserved. whats the difference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "legal java identifiers versus not a keyword/reserved. whats the difference" Watch "legal java identifiers versus not a keyword/reserved. whats the difference" New topic
Author

legal java identifiers versus not a keyword/reserved. whats the difference

Aruna Agrawal
Ranch Hand

Joined: Jan 27, 2005
Posts: 66
Which of the following are not legal Java identifiers?
Select 1 correct option.
a goto
Although not used, it's a reserved word.
b unsigned
It's not a reserved or keyword.
c String
Yes, it is valid. This is a valid statement: String String = "String";
d _xyz
Can start with _ or $
e $_abc
Can have _ or $.

Ans a.
why not b??
Jay Pawar
Ranch Hand

Joined: Aug 27, 2004
Posts: 411
Originally posted by Aruna Agrawal:
Which of the following are not legal Java identifiers?
Select 1 correct option.
a goto
Although not used, it's a reserved word.
b unsigned
It's not a reserved or keyword.
c String
Yes, it is valid. This is a valid statement: String String = "String";
d _xyz
Can start with _ or $
e $_abc
Can have _ or $.

Ans a.
why not b??


because unsigned is not reserved or keyword ( as the explanation is already given) . You can declare a variable something like this
int unsigned = 10; //here unsigned is a variable

If you try to use goto in your java code you will get compiler error.

unsigned is keyword in C++ I believe


Cheers,<br />Jay<br /> <br />(SCJP 1.4)<br />Heights of great men were not achieved in one day, they were toiling day and night while their companions slept.
Nikhilesh Fonseca
Ranch Hand

Joined: Aug 23, 2004
Posts: 57
hey
For pupses of the Exam there are only 2 reserved keywords
1.goto
2.const
Thats it !!thats all you need to kno..
If you are wondering abt true false and null these are manifest constants
and and noooot keywords but for the exam treat them the same as keywords u will not be asked to differetiate betwenn thkey and manifest..K&B

Cheers
Aruna Agrawal
Ranch Hand

Joined: Jan 27, 2005
Posts: 66
hey thanks all.. it was a stupid question.. on readng again my know question i got the answer.. and it got confimed by you all guys...

thanks a lot
aruna..

i will take care not to post just stupid question..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: legal java identifiers versus not a keyword/reserved. whats the difference