Following code is for deleting elemnt from array but it shows NullPointerException at if(names[k].equals(user)) ... how to remove it!!!
public class del_array {
public static void main(String s[])
{
String names[ ] = new String [10];
names[0]="admin";
names[1]="b";
names[3]="m";
String user="b";
for(int k=0;k<names.length;k++)
{
if(names[k].equals(user))
{
String item=names[k];
for(int j=k;j<names.length-1;j++)
{
names[j]=names[j+1];
}
}
}