title: How to delete an element from an array?
body: <p>I'm trying to drop a student from course, and this is what i got so far..</p>
  
  <pre><code>public void dropStudent() {
  
   String id;     
   System.out.println(" Enter student ID " );     
   id = Keyboard.readString();
  
    for ( int i = 0; i &lt;= students.length - 1; i++)   
    {
        if (id.equals(students[i].displayId()))
        {
            for (int j = i; j &lt;= students.length - 1; j++)
            {
            students[i] = students[i+1];
  
            }
  
        }      
     } 
  }
  </code></pre>
  
  <p>So the first loop is for each element of the array, the if statement is to check if the id entered match's a student's id from the array. the second "For" is to shift the elements back. when i try it, it does delete a specific student. but instead of shifting the elements back, it just copies the next element in both places. i tried to set the element to null, but it didn't work.</p>
  
  <p>so any suggestions please ? i'm also not allowed to use array list or other things.</p>