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 domain modeling class diagrams, Java fields map to attributes.
Attributes are shown in the attribute compartment of a classifier
in a class diagram. 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 figure illustrates how attributes are represented with visibility icons in UML class diagrams.
| Java source code | UML visual representation |
![]() |
![]() |