Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Identifiers ! Question Maji exam

 
Nirmala
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Which of the following are valid Java identifiers?
a) _3_
b) $abcp
c) this
d) instance
e) thisabigvariable
f) 2i#
My answer is a,b,d,e.
Given Answer is a,b,c,d,e
Can 'this' be a valid identifier?.
May be very basic Question,but by looking at the answer I am somewhat upset. When I try putting 'this' in an program I got an compilation error. To confirm my answer I am posting this.
Help me.
Thanks in advance.
Nirmala
 
rumit
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is not a valid identifier
i think the book in u read is wrong.
 
Uthirapathi Prabu
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai nirmala,
"this" is not a valid identifier.
It refers to the current executing object.
"this" is the reserved word for java
prabu
------------------
 
Nirmala
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI rumit,
Thank you all for your help.
This is from Maji exam which is specified in the Subject.
Thanks
Nirmala
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Nirmala. The word 'this' can not be a valid identifier. Let us move this thread to our 'Mock Exam Errata' forum.
regds
maha anna
 
Joseph Zhou
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is a Java keyword. keyworks are reserved identifiers that predefined inthe language.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic