问题
I have three classes: Bridge, Main and Car. I have no idea about how to include the main method in my UML representation. Should I list all the attributes...as well as the main method?
The main method does: - a bit of calculation - instantiate the other two classes
I would draw the Main, this way:
---------------------------
Main
---------------------------
---------------------------
+ main(String[] args): void
---------------------------
Is that correct? Thanks
回答1:
Your drawing is good, you just need to underline the main method to show that it is static. I think that you should model it since it shows that this class is one entry point to the system (there may be more).
回答2:
you don't need to include main method in your UML and also as I remember, you should put all the members and methods that are present in your class except the main method. Since the main method is somewhat a given already
来源:https://stackoverflow.com/questions/11280301/how-should-i-represent-the-main-method-java-using-uml