Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Aruna Agrawal
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Nikhilesh Fonseca
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic