I know why there is an error and i have fixed it.. i need someone to explain it properly.. It compiles fine but at runTime it shows Null Pointer Exception at line appString[i][j] = s[j];..Some one know the reason…?
appString = new String[app.size()][];
for(int i = 0; i<app.size();i++)
{
Vector appVec = (Vector) app.get(i);
String[] s = new String[appVec.size()];
appVec.toArray(s);
for(int j = 0 ; j<s.length;j++)
{
//String s1 = s[j];
appString[i][j] = s[j];
}
}
You’ve created the top-level array, but each element of it is null. You need something like:
inside your loop. Or given that you don’t need the array again anyway, you don’t need to loop: