報錯——類型列表<學生>中的添加方法(學生)不適用于參數(整數),求大佬解答
The method add(Student) in the type List<Student> is not applicable for the arguments (Integer),類型列表<學生>中的添加方法(學生)不適用于參數(整數)
The method add(Student) in the type List<Student> is not applicable for the arguments (Integer),類型列表<學生>中的添加方法(學生)不適用于參數(整數)
2020-08-02
舉報
2020-08-02
已解決,因為類型列表<學生>中的添加方法(學生)不適用于參數(整數),所以自定義一個Integer泛型的List就好了。
具體代碼:List<Integer> intList=new ArrayList<Integer>();