title: In Java, when should I create a checked exception, and when should it be a runtime exception?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/27578/when-to-choose-checked-and-unchecked-exceptions">When to choose checked and unchecked exceptions</a>  </p>
  </blockquote>
  
  
  
  <p>When should I create a checked exception, and when should I make a runtime exception?</p>
  
  <p>For example, suppose I created the following class:</p>
  
  <pre><code>public class Account {
      private float balance;
  
      /* ... constructor, getter, and other fields and methods */
  
      public void transferTo(Account other, float amount) {
          if (amount &gt; balance)
              throw new NotEnoughBalanceException();
          /* ... */
      }
  }
  </code></pre>
  
  <p>How should I create my <code>NotEnoughBalanceException</code>? Should it extend <code>Exception</code> or <code>RuntimeException</code>? Or should I just use <code>IllegalArgumentException</code> instead?</p>