title: try catch ArrayIndexOutOfBoundsException?
body: <p>My project consists of a little icon moving over a grid with dimensions 25 by 20. I know I can do this easily with a few if/else blocks, but I want to learn more about error handling. </p>
  
  <p>What I was thinking was using a try catch, but it doesn't catch the array index out of bounds exception or any <code>Exception</code> at all: it does not return "error" or the positions, so it never goes to the catch block.</p>
  
  <p>I was thinking something like this pseudocode:</p>
  
  <pre><code>try {
      // Code
  } catch(The exception) {
     x - 1 or + 1
  }
  </code></pre>
  
  <p>Actual code:</p>
  
  <pre><code> public void tick() {
      Random rand = new Random();
      try {
          int x, y;
          x = rand.nextInt(3) + (-1); //Slumpar fram en siffra (-1, 0, 1)
          y = rand.nextInt(3) + (-1); 
          setPosition(new Point((int)getPosition().getX()+x,(int)getPosition().getY() + y));
      } catch(Exception e) {
          System.out.println("error");
      }
      System.out.println("x: " + getPosition().getX());
      System.out.println("y: " + getPosition().getY());
  }
  
  public String type() {
      return "Dummy";
  }
  </code></pre>