title: Try-catch problem with inheritance (Java)
body: <p>We're trying to implement some sort of Chess game and we have defined an abstract class Piece with constructor:</p>
  
  <pre><code>public Piece(String name) throws EmptyStringException{
      if(name.length()&lt;=0)
          throw new EmptyStringException();
      pieceName = name;
  }
  </code></pre>
  
  <p>And an extending class could look like this:</p>
  
  <pre><code>public King(boolean white) throws EmptyStringException{         
      super("King", white);        
  }
  </code></pre>
  
  <p>The 'problem' here is, if i want to create a new King piece i have to write:</p>
  
  <pre><code>try {
      Piece king = new King(true);
  } catch(EmptyStringException e){
      e.printStackTrace();
  }
  </code></pre>
  
  <p>instead of the much simpler:</p>
  
  <pre><code>Piece king = new King(true);
  </code></pre>
  
  <p>So even though i simply <strong>can't</strong> create an EmptyStringException, i still have to try/catch the exception.</p>
  
  <p>How can i solve this so i can still throw the EmptyStringException in Piece, but don't have to try/catch every time i need to create a new chesspiece ?</p>