如何在 UML 中表示这种 class 关系? (java)
How to represent this class relationship in UML? (java)
以下class是运行为我的程序实例化所有其他class。我想知道如何在结构 UML 图中表示 StartHere class 和 UI class 之间的关系。
import java.awt.EventQueue;
public class StartHere {
public static void main(String[] s) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
UI frame = new UI();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
我建议使用依赖项,因为不会保留引用。如果引用保留在某个字段中,我会推荐一个关联。
以下class是运行为我的程序实例化所有其他class。我想知道如何在结构 UML 图中表示 StartHere class 和 UI class 之间的关系。
import java.awt.EventQueue;
public class StartHere {
public static void main(String[] s) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
UI frame = new UI();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
我建议使用依赖项,因为不会保留引用。如果引用保留在某个字段中,我会推荐一个关联。