PDA

View Full Version : the dollar sign "$", prints like any other normal char in java like "a" or "*" ?


lse123
10-20-2008, 05:32 AM
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
Can you tell me a tutorial with exercises about java me ?

Fou-Lu
10-20-2008, 07:25 AM
You mean like in a println call? Yeah I believe it does. Actually... I seem to recall that you can actually use the $ in a variable as well in Java, but its not recommended practice (especially now that it would like a lot like PHP objects).
Don't quote me on that, but I believe that yes it will print normally without needing escaping, and that it can be used in a variable name.
Just give it a try, worst comes to worst you'll need to escape it.

shyam
10-20-2008, 05:17 PM
right on all points...$ is not a special character in java (except in the context of regular expressions)