This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
hi all, in any book for java, for legal identifiers they say that the identifier should start with a currency character but on keyboard that applies only for '$'. can't they say directly that variable can start with '$' sign. why this kind of generalization ???
A computer once beat me at chess, but it was no match for me at kick boxing.<br />
This is probably one of those things that Java inherited from C and C++, which has the same rules with regard to variable names. One of the goals that James Gosling had in mind when he was inventing Java was that it should be familiar to C++ programmers.
The $ (and others - but never you mind what they are) are intended for use by code generation programs so that no token names will clash with human-written code.
If YOU use the $variable, then you can clash with them.
(Plus it's ugly and looks like a scripting language with a weak parser that can't tell when something is supposed to be... what?... so it needs a special character to say "variable" - my own personal opinion.)
Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);