Representing Structure

Structural concepts, such as class and interface, are fundamental to both Java and the UML. This section identifies how these concepts map to Java and the UML.

Class

In the UML, a Java class is represented via a compartmentalized rectangle. Three horizontal compartments are used:

  • Name compartment: Shows the Java class name

  • Attribute compartment: Lists variables defined on the class, if any

  • Operations compartment: Shows methods defined on the class, if any

Figure 4-1 shows a simple Java class without any variables and methods.

Figure 4-1. A class in Java and the UML

An abstract class is identified by italicizing the class name. ...

Get Developing Enterprise Java Applications with J2EE™ and UML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.