public void myMethod(Object aValue) throws NullPointerException 
{
   if (aValue == null){
      throw new NullPointerException();
   }
   return;
}

Example 3: Using the throws keyword.

Back to Article
Copyright © 1999, Dr. Dobb's Journal