I have String array with some components, this array has 5 components and it vary some times. What I would like to do is to iterate through that array and get the first comp
You can do an enhanced for loop (for java 5 and higher) for iteration on array's elements:
String[] elements = {"a", "a", "a", "a"}; for (String s: elements) { //Do your stuff here System.out.println(s); }