oopumlclass-diagramconceptual

How to show usage of static methods UML Class Diagram


How do i show the use of static methods in a UML class diagram?

class A{
    public static void test(){
    }
}

class B{
    public void b(){
    A.test();
    }
}

How would a class diagram look like, which shows the relationship? UML 2.0 would be prepared, if there is a difference.


Solution

  • To show a static method you underline the name of the static method - have a look here for more detailed info.

    As for navigating that relationship; class B is dependent on the existance of class A. We can say that class B has a "usage dependency" on class A

    class B ----uses----> class A
    

    Hope this helps.