你没有赋值//构造函数 public Person(Dog dog,int age,String name) { this.age=age; this.name=name;增加一下代码this.dog=dog; }所以你调用 p1.dog.show_Dog_Name();p1.dog还是null