yxs1112003
public interface clothes{}public class Coat implements clothes{}public Person{ public void wear(Clothes coat){ }}public PersonTest{ public static void main(String[] args){ Person p = new Person(); Clothes coat = new Coat(); p.wear(coat); }}黑体就是多态了。多太有什么好处?多态可以消除复杂的条件语句或者switch语句,详情请查询关键词“工厂模式 多态 switch 消除”