UML Class Notation
Classes represent the concept of encapsulating state (attributes) and behavior (operations). Each attribute has a type. Each operation has a signature. The class name is the only required information.

Encapsulation is the principle of data hiding: an object hides its data from external access and only allows external entities to manipulate the data by calling the object’s methods.
The degree to which elements of a class are encapsulated depends on the visibility level of the element. The visibility of a property or operation specifies whether objects of other classes can “see” or access that property or operation.
UML supports the following four levels of visibility:
Characters ~, +, #, and – placed before the name of an attribute or operation in a class indicate its visibility:
- Package Visibility (represented by tilde ~) means any object from a class within the same package can see and use the given class.
- Public Visibility (+) means any object from any class can use the given attribute or operation.
- Protected Visibility (#) means only objects from subclasses of the given class (i.e., classes lower in the hierarchy) can access the attribute or operation.
- Private Visibility (-) means only objects of the class itself can use the attribute or operation.
The following image shows visibility modifiers for example attributes and operations:

