Sponsored Link •
|
Advertisement
|
Define exceptions in the package in which they are thrown.
// In file TemperatureException.java class TemperatureException extends Exception { } // In file TooColdException.java class TooColdException extends TemperatureException { } // In file TooHotException.java class TooHotException extends TemperatureException { }
TemperatureException
, for example, can
catch TooHotException
and TooColdException
catch (TooHotException e) { ...
has meaning
Sponsored Links
|