What’s the point of putting parameters before parameters in Java / Android?

What is the difference or meaning of placing the $symbol before any variable or parameter?

for example

Suppose this is my class

public class Vector3 {
      public Vector3(float x,float y,float z){
           //...
          //... my ctor code
          //...
      }
 }

What is the difference between these two statements

Declaration 1

Vector3 $vec = new Vector3(1f,1f,1f);

Declaration 2

Vector3 vec = new Vector3(1f,1f);

If you notice $sign before "VEC" in statements 1 and 2

Any leads?

In addition, declare the same constructor as below,

public class Vector3 {

    public Vector3(float $x,float $y,float $z){
    //...
    //... my ctor code
    //...
    }
}

What is the difference between the above constructor and the initial constructor?

Thank you

Editor: Thank you for all your replies. I did this in different combinations. It doesn't make any sense:) I thank you for all your answers

Solution

According to the Java language specification, this is allowed, but has no special meaning Note that the specification continues to recommend that it "be used only for mechanically generated source code, or rarely for accessing pre-existing names in legacy systems"

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>