In Unified Modeling Language (UML) class diagrams, an attribute represents a data definition for an instance of a classifier. An attribute describes a range of values for that data definition.
A classifier can have any number of attributes or none at all. Attributes describe the structure and value of an instance of a class.
For example, a Client class might have a balance attribute that holds the amount of money in the client's account.
In UML class diagrams, Java™ fields map to attributes.
Attributes are shown in the attribute compartment of a shape. Attributes
that are defined in the scope of the class, that is static, are shown as underlined.
The visibility styles of attributes can be represented as text symbols (such
as "-") or icons (such as ).
The following figures illustrates how attributes are represented with visibility icons in class diagrams.
Java source code | UML visualization |
![]() |
![]() |