MyClass[] myArray; | creates a reference to an array whose elements are of type "MyClass" |
myArray = new MyClass[10]; | creates an array of ten elements (index 0 to 9). |
for (int i=myArray.length-1; i>=0; i--)
myArray[i] = new MyClass(); | create ten instances of MyClass and store them in array |
int i=0;
for ( ; i< myArray.length; i++)
if (tested(myArray[i]))
break; | find first occurrence of tested element in array |
// import java.util.Vector; Vector myVector = new Vector(); | create a new vector object |
for (int i=1; i<= 10; i++)
myVector.add(new MyClass()); | add ten instances of MyClass to the vector |
int i=0;
for ( ; i< myVector.size(); i++)
if (tested(myVector.elementAt(i))
break; | find first occurrence of tested element in vector. |