Exceptions
Anything that can go wrong should result in the raising of an Exception
Exception is a class with many subclasses for specific things that can go wrong
Use a try - catch block to trap an exception
try
{
// some code
}
catch (ArithmeticException e)
{
// code to handle division by zero
}
Previous slide
Next slide
Back to first slide
View graphic version