????3.????Aggregation??

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????“????-????”?????????
??????????????
????public class People{
????Car car;
????House house;
????//???????????????????????????set???????
????public void setCar(Car car){
????This.car=car;
????}
????public void setHouse(House house){
????This.house=house;
????}
????public void driver(){
????System.out.println(“????????”+car.getType());
????}
????public void sleep(){
????System.out.println(“??????????????”+house.getAddress());
????}
????}
????4.????Composition??


???????????????????????????????????????????????????“????-????”??????????“????”????“????”??????????????????????????????????“????”?????????????κ????塣????????????У?People??Soul??Body?????????????????????????????????????????????壻?????????????????????????????????????????????????壬?????????????????????????????????????
????Public class People{
????Soul soul;
????Body body;
????//??????е???????????????????и??
????Public People(Soul soul??Body body){
????This.soul=soul;
????This.body=body;
????}
????Public void study(){
????System.out.println(“????????”+soul.getName());
????}
????Public void eat(){
????System.out.println(“????????壺”+body.getName());
????}
????}
????5.??У?Generalization??

??????б????????????????????????????????java?У??ù????extends?????й????UML????У???й???????+???????????????????
????6.????Implementation??

?????????????????????????????????????ò?????????????????????????????????java?????implements?????UML????У????????????+????????????????????
??????java?м?????extends????????????implements????????????????????????