import java.util.Iterator; class TestVaarIterator { public static void main(String[] args) { VaarArray vaarArray = new VaarArray<>(10); String test = "test "; for (int i = 0; i <8; i++) { vaarArray.settInn(test + i); } System.out.println("Bruker iterator"); Iterator it = vaarArray.iterator(); while (it.hasNext()) { System.out.println(it.next()); } System.out.println("Skriver ut med ? bruke for each"); for (String s:vaarArray) { System.out.println(s); } } }