• Post Reply Bookmark Topic Watch Topic
  • New Topic

Question about identifiers  RSS feed

 
Izaak Prats
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Today while going though some of the Practice-It! self-checks I couldn't get pass a question that asked me to look at the following words and check all of the legal identifiers. I did as it had asked and did not check the ones with non alpha-numerical characters other than an underscore or money symbol, along with the ones that started with numbers. The only problem is that it kept saying that I was wrong until I had unchecked for. I thought that "for" would be a legal identifier (without the double quotes), could someone please explain?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the page on Reserved Words
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fred's link doesn't work... try this one: Java Language Keywords

You know the "for" loop? "for" is a keyword, you cannot use it as an identifier.

And welcome to the Ranch!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!