'How should I denote static classes in UML?

So I did some research about how to denote static methods and classes in UML. I found on these two pages that static methods should be denoted by underlining them, but what is the correct way to display a class as being static?



Solution 1:[1]

I would just use a stereotype <<static>>

Solution 2:[2]

IMO static classes (like in C#) should not even be used in OO Design. A static class cannot be instantiated and thus is actually not a class regarding UML semantics.

You could mark the class as "leaf" (no subclasses) and add a constraint which does not allow non-static members. This would resemble the meaning of the C# static keyword.

Solution 3:[3]

The <<utility>> stereotype is what you are looking for.

It's defined in UML Standard Profile (as per UML 2.5 documentation) as:

A class that has no instances, but rather denotes a named collection of attributes and operations, all of which are static.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 gefei
Solution 2 Christian
Solution 3 M.Sameer