java - Null pointer exception in for loop -


i try string don't want string array getting array loop.

i try following code java.lang.nullpointerexception , don't know why.

thank helping.

string unwanted = new string[]{"","a","b","c"};  string[] temp = new string[unwanted.length-1]; int p = 0; (int k = 0; k < unwanted.length; k++){     if(unwanted[k].equals("") == false)     {         temp[p] = unwanted[k];         p++;     } } 

the error here string array declaration

string[] unwanted = new string[]{"","a","b","c"}; 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -