import java.util.*; public class Alice { public Alice() { // Fill the ArrayList. ArrayList battle = new ArrayList(); for (int i = 0; i < 100; i++) { if (Math.random() < 0.5) { battle.add("Tweedledum"); } else { battle.add("Tweedledee"); } } // Delete one String type. for (int i = 0; i < battle.size(); i++) { if (battle.get(i).equals("Tweedledum")) { battle.remove(battle.get(i)); i--; } } // Test. // Note, just to show you an alternative, the following uses a while loop // and a data structure called an Iterator, which you can get from an ArrayList. Iterator si = battle.iterator(); String temp = null; while (si.hasNext()) { temp = si.next(); System.out.println(temp); } } public static void main (String args[]) { new Alice(); } }