我正在尝试使用以下代码:
List<ItemInterface> interfaceList = new List<ItemInterface>();
Eclipse报错:Cannot instantiate the type List
这段代码有什么问题?
最佳答案
List 本身就是一个接口(interface)。你需要使用类似的东西:
List<ItemInterface> interfaceList = new ArrayList<ItemInterface>();
关于Java : A List of type interface,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7664986/