Delete Item from an Array

Sometime it is necessary to delete an item from an array.

   String[] names = {"Anna" , "Bad" , "Carla" , "Dumbo","Ed"};

After deleting "Bad", the array should look like this:

   String[] names = {"Anna" , "Carla" , "Dumbo","Ed", "zzz"};

where "zzz" indicates an empty position.  Write a method to find a name and delete it, moving following names up one position and filling the last position with "zzz". 

Solution

public void delete( String target )
{
    for(int c = 0;  c < names.lengthc = c+1)
    {
        if( names[c].equals( target ) )
        {
            for(int x = c ; x < names.length-1; x=x+1)
            {
                names[x] = names[x+1];  
                // copy name ahead one position 
            }  
        }
    }
    names[names.length-1] = "zzz";
}