import java.util.Vector; public class MainClass { public static void main(String args[]) { String members[] = { "A", "I", "C", "D", "E", "F", "G", "H", "I", "J" }; Object value = "I"; Vector v = new Vector(); for (int i = 0, n = members.length; i < n; i++) { v.add(members[i]); } int index = 0; int length = v.size(); while ((index < length) && (index >= 0)) { index = v.indexOf(value, index); if (index != -1) { System.out.println(index); index++; } } } }
1 8