netbeans 错误说:new表达式中的冗余类型参数请改用菱形运算符...正在< USCrimeClass>尝试将数据文件调用到数组列表

xmq68pz9  于 2022-11-10  发布在  其他
关注(0)|答案(2)|浏览(64)
ArrayList storeList = new ArrayList<USCrimeClass>;
FileInputStream fstream = new FileInputStream(inFile);
try ( // Get the object of DataInputStream
           DataInputStream in = new DataInputStream(fstream)) {
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    String strLine;
    // Read File Line By Line
    strLine = br.readLine();// skip first line
    while ((strLine = br.readLine()) != null) {
          // lines
          storeList.add(storeToCrimeObjin(strLine));
    }
    // Close the input stream
jutyujz0

jutyujz01#

new ArrayList<USCrimeClass>;中有缺失(),它应该是:

ArrayList storeList = new ArrayList<USCrimeClass>();
nwwlzxa7

nwwlzxa72#

ArrayList<USCrimeClass> storeList = new ArrayList<>();

菱形运算符<>现在位于语句的后半部分。
除此之外,我想说@gawi是对的。

相关问题