idea编译中cannot be applied to怎么解决

img

看一下包导入正不正确。下面提示了。
没有合适的构造器。

你仔细检查一下person和family里面有没有两个字符串类型的参数的构造方法,估计是没有的,你就写一个这样的方法即可,例如

 public Person(String id, String name) {
        this.id = id;
        this.name = name;
    }

其中id和name是你的person类里面的两个属性

你肯定family的构造器是person类型,不是字符串,没法把字符串放进去,应该放个person对象