Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do variable names often start with the letter 'm'? [duplicate]

People also ask

What does M mean in variables?

where m is the slope. where b is the y -intercept. The slope is the change in y over the change in x. This is commonly known as the riserun .

Why do Android variables start with M?

Originally Answered: Why android professional programers name variables with 'm' at the beginning like mImage? The 'm' stands for 'member' and tells you that a variable isn't a local variable or a method parameter but a class member. Another often used naming convention is to start member names with '_'.

What does M mean in programming?

M is an abbreviation used for the MUMPS programming language. 2. When used to describe a keyboard shortcut or sequence, "M-" is the GNU notation used to represent the meta key or Alt key if set up as a meta key. For example, M-c is short for pressing Alt and C at the same time on the keyboard.

What does M stand for in Java?

Letter m as prefix means that it is member of class. Letters lv means that it is local variable. Letters pm means that it is parameter.


It stands for member. I personally find this convention unhelpful, but it's subjective.


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."


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.


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)

'm' means member of the class. So, if you don't use IDE to highlight your members, then you will understand that it is a member by it's name