UNB/ CS/ David Bremner/ teaching/ java/ Remove1.java
public class Remove1
{  public static void main(String[] args)
   {  ConsoleReader console = new ConsoleReader(System.in);
      
      String[] staff = new String[5];
      staff[0] = "Harry";
      staff[1] = "Romeo";
      staff[2] = "Dick";
      staff[3] = "Juliet";
      staff[4] = "Tom";
      int staffSize = staff.length;

      print(staff, staffSize);

      System.out.println("Remove which element? (0 - 4)");
      int pos = console.readInt();

      // overwrite the removed element with the last element

      staff[pos] = staff[staffSize - 1];
      staffSize--;

      print(staff, staffSize);
   }
   
   /**
      Prints an array of strings
      @param s the string array
      @param sSize the number of strings in the array
   */
   public static void print(String[] s, int sSize)
   {  for (int i = 0; i < sSize; i++)
         System.out.println(i + ": " + s[i]);
   }
}