Invalid constructor reference when using local class?

后端 未结 2 1204
小蘑菇
小蘑菇 2021-02-02 09:09

Given the following code:

package com.gmail.oksandum.test;

import java.util.ArrayList;
import java.util.List;

public class Test {

    public static void main(         


        
2条回答
  •  太阳男子
    2021-02-02 10:04

    One problem is that you are trying to instantiate the Arraylist by specifying the generic type in the list, but not using the same type in the Arraylist.

    Use : List ls = new ArrayList();

    Also please provide a default constructor for LocalFoo

提交回复
热议问题