-1

for example,sometimes I see function like this:

public void changeColor(Color aColor){
}

what is the function or meaning of "a" in parameter "aColor"?

ggrr
  • 7,737
  • 5
  • 31
  • 53

2 Answers2

0

That is just what they named the variable. You may also see "m" in a lot of other people's code, especially if you look through the Java source code. Example mColor, mOnTouchListener, etc.

Chamatake-san
  • 551
  • 3
  • 10
0

Functions take arguments. In Java these arguments must be declared as a type(in this case a "Color" object) and named. The name of the argument doesn't matter. Imagine it as creating a new Color variable as such.

Color aColor;

and setting the variables value to whatever Color object you pass the function when you call it.

Now you have a Color named aColor that has a value that you set. There is nothing special about the name aColor, its just a name.

lleontan
  • 123
  • 1
  • 11