What is the difference between field, variable, attribute, and property in Java POJOs?

Victor Lyuboslavsky picture Victor Lyuboslavsky · Apr 12, 2012 · Viewed 108.6k times · Source

When referring to internal private variables of Java POJOs that have getters/setters, I've used the following terms:

  • field
  • variable
  • attribute
  • property

Is there any difference between the above? If so, what is the correct term to use? Is there a different term to use when this entity is persisted?

Answer

jahroy picture jahroy · Apr 12, 2012

From here: http://docs.oracle.com/javase/tutorial/information/glossary.html


  • field

    • A data member of a class. Unless specified otherwise, a field is not static.

  • property

    • Characteristics of an object that users can set, such as the color of a window.

  • attribute

    • Not listed in the above glossary

  • variable

    • An item of data named by an identifier. Each variable has a type, such as int or Object, and a scope. See also class variable, instance variable, local variable.