Exceptions and Exception Handling

April 18th, 2016

Slides

Lecture Recording

Lecture Code

Exception Handling

Exceptions

User Defined Exceptions

  public class MyException extends ExistingException
  {
    public MyException ()
    {
    }

    public MyException (String message)
    {
      super(message);
    }
  }

Class Exercise

Write a program that asks the user to enter an integer than is ≥ 5 and ≤ 10. The program should continue prompting the user until a valid number is entered.