If your program may run into a problem that isn't addressed by any of the standard exception classes, you can create your own exception class by deriving it from Exception or from a child class of Exception, such as IOException. In this example, an exception is thrown for each value 0 through 9. The "error" message simply indicates whether the value is even or odd.