UML类图
UML类图理解
依赖关系

1public class Person {
2 public void doSomething(){
3 Card card = new Card();//局部变量
4 ....
5 }
6}
1public class Person {
2 public void doSomething(Card card){//方法参数
3 ....
4 }
5}
1public class Person {
2 public void doSomething(){
3 int id = Card.getId();//静态方法调用
4 ...
5 }
6}
关联关系

1public class Person {
2 public Phone phone;
3
4 public void setPhone(Phone phone){
5 this.phone = phone;
6 }
7
8 public Phone getPhone(){
9 return phone;
10 }
11}
聚合关系

1public class Team {
2 public Person person;
3
4 public Team(Person person){
5 this.person = person;
6 }
7}
组合关系

1public class Person {
2 public Head head;
3 public Body body;
4 public Arm arm;
5 public Leg leg;
6
7 public Person(){
8 head = new Head();
9 body = new Body();
10 arm = new Arm();
11 leg = new Leg();
12 }
13}
继承关系

