Why do variable names often start with the letter 'm'?
The m is here to indicate a member variable.
It has 2 huge advantages:
- If you see it, you instantly recognize it as a member variable.
- Press m and you get all members via the auto completer. (This one is not in the other answers)
According to Android source code documentation:
- Non-public, non-static field names start with m.
- Static field names start with s.
- Other fields start with a lower case letter.
- Public static final fields (constants) are ALL_CAPS_WITH_UNDERSCORES.
Note that this is for writing Android source code. For creating Android apps, the Google Java Style Guide may be more helpful.
See Code Style Guidelines for Contributors: Follow Field Naming Conventions. The use of the "m" prefix is more specific that simply denoting a "member" variable: It's for "non-public, non-static field names."
It stands for member. I personally find this convention unhelpful, but it's subjective.