title: Throw exception and NOT terminate program in java
body: <p>So I have a program that I want to check if a set of cords are inside a gameboard, and if they are not, to throw an error, but continue with the program. Here is the code used (I'm not worried about class/package names):</p>
  
  <pre><code>package routines;
  
  import java.util.Random;
  
  import game.GameBoard;
  import game.Player;
  
  public class MovePlayer extends Routine {
  final protected int destX;
  final protected int destY;
  
  public MovePlayer(int destX, int destY, GameBoard board) {
      super();
      if(destY &gt; board.getHeight() || destX &gt; board.getWidth()) {
          fail();
          throw new RuntimeException("&gt;&gt;&gt; Error while creating routine, one or more coords are outside of the game board");
      } else {
          this.destX = destX;
          this.destY = destY;
      }
  }
  </code></pre>
  
  <p>And here is a link to the super class (a lot of code, not sure if I should put all of it in here) <a href="http://pastebin.com/3iAh9sGY" rel="nofollow">Super class SRC</a></p>
  
  <p>EDIT: Not sure if this will fix what I was wanting, but all I did was remove the <code>final</code> keyword from the variables</p>
  
  <p>EDIT #2: So I finally figured what I was doing wrong. 1) the variables were marked as final. 2) It was some of my other code that was causing this to happen <em>*facepalm*</em> All of my code has been pushed to a new Git repository, so if you should so choose, you can look at what I did here: <a href="https://github.com/AXIUM1998/VI-Arena" rel="nofollow">VI-Arena Git repository</a></p>