`// This rule specifies whether you are allowed to throw
// Exceptions of type Exception.
// Exception is the base class of all exception and
// therefore very generic and not meaningfull. It is hard
// for the client to determine what went wrong. With
// specialized exception you know exactly what is going on.
// If this rule is enabled you have to throw subclasses of
// Exception.
// Throwing of Exception
public void print(String printer) throws Exception
{
...
// printer couldn't be found
throw new Exception("Printer not found");
...
// printer has no paper
throw new Exception("Printer has no paper");
...
}
// Throwing of specialized Exceptions
public void print(String printer) throws NoPrinterException,
OutOfPaperException
{
...
// printer couldn't be found
throw new NoPrinterException("Printer not found");
...
// printer has no paper
throw new OutOfPaperException("Printer has no paper");
...
}
`