this while loop works, but it just doesnt catch the exception.. can anyone see whats wrong? i am supposed to catch the exception if an illegal lunch is entered in readLunch(), and discard it from the lunches array if its illegal. if its not, continue reading the array
while (!done) { try { lunches[numLunches] = readLunch(); numLunches++; } catch (Lunch.IllegalLunchFieldException e) { System.out.println (e.getMessage()); // deletes the illegal lunch just entered lunches[numLunches] = lunches[numLunches-1]; // decrement illegal lunch numLunches--; } // end try-catch block
if (numLunches == MAX_LUNCHES) done = true; else { System.out.print("enter more lunches (y/n)? "); done = !readBoolean(); } // end if