N
NickPick
I have a problem with the .split method. It causes a
NullPointerException when I try to read form a .csv file which has
several lines of comma separated values which I'd like to put into p
[]. The code works fine when I remove the do..while. Do I maybe have
to re-initialise the String[] price somehow? Any advice is
appreciated.
do {
String[] price = new String[1000];
line = buff.readLine();
price = line.toString().split (","); // CAUSING
NullPointerException.
i++;
p=Float.parseFloat(price[4]);
} while (line != null);
NullPointerException when I try to read form a .csv file which has
several lines of comma separated values which I'd like to put into p
[]. The code works fine when I remove the do..while. Do I maybe have
to re-initialise the String[] price somehow? Any advice is
appreciated.
do {
String[] price = new String[1000];
line = buff.readLine();
price = line.toString().split (","); // CAUSING
NullPointerException.
i++;
p=Float.parseFloat(price[4]);
} while (line != null);