我是Java新手,想要學習程序員可以使用的各種集合。我在Eclipse中將「java.util」導入到剪貼簿中,並檢查了以下代碼。「類型ArrayList不是泛型」是什麼意思?
ArrayList<String> list = new ArrayList<String>();
list.add("test1");
list.add("test2");
我收到了這個輸出。
The type ArrayList is not generic; it cannot be parameterized with arguments <String>
Syntax error, parameterized types are only available if source level is 5.0
The type ArrayList is not generic; it cannot be parameterized with arguments <String>
Syntax error, parameterized types are only available if source level is 5.0
這個錯誤是什麼意思?我沒有製作一個通用的數組列表;我做了一個字符串數組列表。此外,什麼是「源級」?
了Java版本小於5 – kosa