Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the "m" stand for in java code [duplicate]

Tags:

java

android

What does the "m" mean when it is put as a prefix before a word in android programming particularly in android java class files? I have lately been seeing it a lot in my generated main activity. Where can you use "m" as a prefix for statements/terms in programming? Like in the examples below:

mUserLearnedDrawer
mCurrentSelectedPosition
mFromSavedInstanceState
mUserLearnedDrawer
like image 620
Vimbainashe E Mushayikwa Avatar asked Mar 07 '15 13:03

Vimbainashe E Mushayikwa


People also ask

What is M in variable name?

'm' means the variable is a member variable of the class...

What does this mean in Java code?

The this keyword refers to the current object in a method or constructor. The most common use of the this keyword is to eliminate the confusion between class attributes and parameters with the same name (because a class attribute is shadowed by a method or constructor parameter).

What does >>= mean in Java?

The >> operator is a signed right shift operator and >>> is an unsigned right shift operator. The left operands value is moved right by the number of bits specified by the right operand.


2 Answers

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.

example:

class Example
{
  Integer mMemberOfClass;

  public void someMethod(Object pmSomeParameter)
  {
    Integer lvSomeLocalVariable;

  }

}
like image 96
Piotr Zych Avatar answered Sep 23 '22 06:09

Piotr Zych


Simply it means this variable is member of the class.

like image 28
Ajay S Avatar answered Sep 20 '22 06:09

Ajay S