Throwing Exceptions

User Defined Exceptions

Testing Terminology

Testing Tips

Lecture Code

The infinite loop in lecture was caused by the fact that when a string such as apple is entered, the InputMismatchException handler does not clear the Scanner's input buffer. Adding the code in.nextLine(); to the exception handler clears the buffer and fixes the problem. This is needed for the code to work properly on either a Mac or a PC.