Search code examples
umlclass-diagram

UML class diagram for static variable from other class


As I know, if the static method from other class, we may interpret their relationship with dependency, just like the answer from How to show usage of static methods UML Class Diagram

However, how about for the static variable from other class? Is it the similar case; using dependancy?

For example,

class A{
    public static String CHAR="Charecter";
    public static String INT="Integer";
    public static String STR="String";
}

class B{
    public String Type;
    public B(){
    Type=STR;
    }
    public void B(String t){
    Type=t;
    }
}

would it result in the uml class diagram as below? enter image description here

Note that although I would rather use enumeration in real life for this case, I just would like to know how it works.


Solution

  • Yes, this is similar.

    Dependency shows that one class is "aware" of some other class and uses it in some way (or more generally depends on it). It can for instance refer to (public) static attributes, static operations and so on.