gpt4 book ai didi

java - 空指针访问: The variable b can only be null at this location

转载 作者:行者123 更新时间:2023-12-02 04:29:44 24 4
gpt4 key购买 nike

我在代码的以下部分的最后一行中收到上述错误。

String[][] b = null;
try {
br = new BufferedReader(new FileReader(csvFile));
while ((line = br.readLine()) != null) {
// use comma as separator
String[] country = line.split(cvsSplitBy);
String[] a=country[1].split(splits);
i = 0;
n = 0;
while(i<a.length) {
b[j][n]+=a[i];
}
}
} catch (...) {}

此错误的原因是什么以及如何解决?

最佳答案

b 的唯一两种用途是

b = null;
...
*b[j][n] ...

您需要将 b 设置为实际数组,然后才能尝试对其建立索引。

关于java - 空指针访问: The variable b can only be null at this location,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31628486/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com