title: Java, using throw without try block
body: <p>For the following method, is it okay to throw the exception when it isn't inside a 'try' block?</p>
  
  <pre><code>public void setCapacity(x) throws CapacityExceededException {
      if (x &gt; 10) throw new CapacityExceededException(x);
      else this.x = x;
  }
  </code></pre>