public String[][] fetchData()
{
String[][] data = null;
int counter = 0;
while (counter < 10){
data[counter] = new String[] {"abc"};
counter++;
}
return data;
}
Getting the error in this loop. Please let me know where i am wrong
You need to allocate memory to data.
String[][] data = new String[ROW][COLUMN].
Read this
String[][] data = null;
==> you have a null pointer exception when you try to write in data
You might do
String[][] data = new String[10][];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With