Another way to break a for loop with java?
<p>is there any other way to break this loop without using the actual <strong><em>break</em></strong> statement?
the thing is for some reason my professor doesn't like that we use break in any other place that in the <strong><em>switch</em></strong></p>

<p>i am having troubles in my method adding an object into the array of objects in the next empty space in the array</p>

<p>this is my code: (any other way to do it?)</p>

<pre><code>public void add(Employee employeeObj)throws ArrayIndexOutOfBoundsException{
        try{
            for(int i= 0; i&lt;MAX; i++){
                if(listEmployee[i] == null){
                    listEmployee[i] = employeeObj;
                    break;
                }

            }
        }catch(ArrayIndexOutOfBoundsException e){
            throw new ArrayIndexOutOfBoundsException("ERROR!");
        }
    }
</code></pre>

<p>the method just need to add the employeObj into the array and if the case, thows an exception.
thanks for your help</p>
