The convention says: "Non-public, non-static field names start with m. Other fields start with a lower case letter". Does it refer to class field only (like in example 1) or to all field (like in example 2)?
Example 1
public class One {
private int mFieldOne;
private int mFieldTwo;
public void someMethod(){
int methodFieldOne;
int methodFieldTwo;
}
}
Example 2
public class Two {
private int mFieldOne;
private int mFieldTwo;
public void someMethod(){
int mMethodFieldOne; //see m here
int mMethodFieldTwo; //see m here
}
}
In your second example, mMethodFieldOne and mMethodFieldTwo are not fields, just variables local to someMethod, so the naming convention does not apply.
It refers to fields only, which are the class members (= m). The others are local variables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With