What is the difference or significance of putting $ sign before any variable or parameter..
e.g.
Suppose here is my class...
public class Vecto
While many people have pointed out that $
is legal in identifiers, I refute the use of $
(at least as an initial token) as it goes against the Java Naming Conventions:
Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed.
While this does not include the case of foo$bar
I follow the JLS recommendation that the $
be used only in generated code. The Java compiler uses $
when it generates anonymous classes, for instance.
If nothing else, I would consider your code ugly :-)
Variable names are case-sensitive. A variable's name can be any legal identifier — an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign "$", or the underscore character "". The convention, however, is to always begin your variable names with a letter, not "$" or "". Additionally, the dollar sign character, by convention, is never used at all. You may find some situations where auto-generated names will contain the dollar sign, but your variable names should always avoid using it. A similar convention exists for the underscore character; while it's technically legal to begin your variable's name with "_", this practice is discouraged. White space is not permitted.
Taken from : ttp://download.oracle.com/javase/tutorial/java/nutsandbolts/variables.html#naming
I don't believe it is anything more than a valid symbol for use in Java variable names. From the Java tutorial on variables ( http://download.oracle.com/javase/tutorial/java/nutsandbolts/variables.html ):
Variable names are case-sensitive. A variable's name can be any legal identifier — an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign "$", or the underscore character "_". The convention, however, is to always begin your variable names with a letter, not "$" or "_". Additionally, the dollar sign character, by convention, is never used at all. You may find some situations where auto-generated names will contain the dollar sign, but your variable names should always avoid using it. A similar convention exists for the underscore character; while it's technically legal to begin your variable's name with "_", this practice is discouraged. White space is not permitted.
According to the Java Language Specification, it's permissible, but has no special meaning. Note that the specification goes on to recommend that it "only be used in mechanically generated source code, or rarely, to access pre-existing names in a legacy system".
compiles and runs. kid you not.
package $;
public class $
{
int $;
int $(int $){ return $; }
void $$(int $){ this.$=$; }
$ _(){ return this; }
$ _;
{
$$($($));
_._()._._()._();
}
}