What is the difference or significance of putting $ sign before any variable or parameter..
e.g.
Suppose here is my class…
public class Vector3 {
public Vector3(float x, float y, float z){
//...
//... my ctor code
//...
}
}
and what will be the difference between these two declarations…
Declaration 1
Vector3 $vec = new Vector3(1f,1f,1f);
Declaration 2
Vector3 vec = new Vector3(1f,1f,1f);
If you can notice $ sign before “vec” in Declaration 1 and Declaration 2.
Any clues?
Also, declaring the same constructor as below,
public class Vector3 {
public Vector3(float $x, float $y, float $z){
//...
//... my ctor code
//...
}
}
What is difference between above constructor and the initial constructor ?
Thanks…
Edit: Thanks to all your responses, I did this with different combinations and there is no major significance 🙂 I appreciate all your answers.
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”.