Naming conventions

It's possible to use a variable naming convention to distinguish between fields, arguments, and local variables.

Within the body of a method, all of these types of variables can appear. You may find naming conventions to be a helpful aid in getting a rapid understanding of a method's implementation. These conventions have only one purpose: to pour understanding into the brain of the reader as quickly as possible.

To understand a method, you need to understand its data. An important part of understanding data is understanding where it's defined - as a field, argument, or local variable. Naming conventions which distinguish these cases usually allow the reader to understand an implementation more quickly, since they no longer need to scan the class to determine where items are defined.

Many would say that such variable naming conventions are not needed when:

Most code examples on this site use these common naming conventions:

Some older code examples on this site follow this style:

The return value of a method is sometimes given a conventional name as well.

See also Oracle's remarks on naming conventions in general.

See Also :
Conventional name for return value
Coding conventions
Avoid basic style errors
Short public methods