title: Unhandled Exception Type in JAVA
body: <p>I have a two classes in the same package in JAVA.</p>
  
  <p>One class in which I have a constructor an exception I tried to create myself:</p>
  
  <pre><code>public class ZooException extends Exception {
  
          public ZooException(String error) {
              super(error);
          }   
  }
  </code></pre>
  
  <p>Another class needs to call this exception at one point:</p>
  
  <pre><code>public class Zoo&lt;T extends Animal&gt;
  
  Zoo(int capacity) {
          if (capacity &lt;= 1) {
          throw new ZooException("Zoo capacity must be larger than zero");
      }
  }
  </code></pre>
  
  <p>I notice two things here</p>
  
  <ol>
  <li>In the ZooException class, I get a warning: "The serializable class CageException does not declare a static final serialVersionUID field of type long"</li>
  <li>In the Zoo class, on the line that starts with "throw new", I get a compile error: "Unhandled exception type CageException"</li>
  </ol>
  
  <p>Any ideas on what I can do to solve this error in the Zoo class? Thank you in advance!</p>