Java | 报错:Cannot instantiate the type Map(String ,Object)

错误代码

Map<String,Object>  fisrstMapSection = new Map<String, Object>();

错误原因

        这里是对基础知识不好导致,map是一个抽象的接口,不能直接实例化

解决方法:

        可以使用它的具体的实现类

        Map<String,Object>  fisrstMapSection = new HashMap<String, Object>();

猜你喜欢

转载自blog.csdn.net/weixin_48419914/article/details/121458459