title: Java error on setLocation(x,y)
body: <p>I am coding a simple mouse and cat game. 
  But I always got a debug error when i try to use setLocation.</p>
  
  <p>Can you tell me how can i fix it? i dont think there is anything wrong.</p>
  
  <pre><code>import java.awt.Point;
  import java.util.Random;
  
  public abstract class Animal {
  
  Point location_;
  String name_;
  Random rng_;
  
  public Animal() {
  }
  
   public Animal( String name, Random rng ){
      name_=name;
      rng_=rng;
  }
  
  
  abstract void move();
  
   public String getName(){
       return name_;
   }
  
   public Point getLocation(){
       return location_;
   }
  
   public void setStartLocation(){
       int x = rng_.nextInt(4);
       int y = rng_.nextInt(4);
  
  
  // error 
      location_.setLocation(x, y);
   }
  
  }
  </code></pre>
  
  <p>another file: </p>
  
  <pre><code>import java.util.Random;
  
  public class Cat extends Animal {
  
  
  
  public Cat(String name, Random rng){
      super(name,rng);    
  }
  
  
  void move() {
      int i = rng_.nextInt(3);
      int x = (int) location_.getX();
      int y = (int) location_.getY();
  
      if(i==0 &amp;&amp; y&lt;4){
  
          int newY = y++;
  
          location_.move(x,newY);
      }
  
      else if (i==1 &amp;&amp; y&gt;0){
  
          int newY = y--;
  
          location_.move(x,newY);
      }
  
      else if (i==2 &amp;&amp; x&gt;0){
  
          int newX = x--;
  
          location_.move(newX,y);
      }
  
      else if (i==3 &amp;&amp; x&lt;4){
  
          int newX = x++;
  
          location_.move(newX,y);
      }
  
      else move();
  
  }
  
  
  
  }
  </code></pre>
  
  <p>another file:</p>
  
  <pre><code>import java.util.Random;
  
  public class Mouse extends Animal {
  
  String mobility;
  
  public Mouse(String name, Random rng){
      super(name,rng);    
  }
  
  
  void move() {
      int i = rng_.nextInt(3);
      int x = (int) location_.getX();
      int y = (int) location_.getY();
  
      if(i==0 ){
  
          int newY = y++;
  
          location_.move(x,newY);
      }
  
      else if (i==1){
  
          int newY = y--;
  
          location_.move(x,newY);
      }
  
      else if (i==2){
  
          int newX = x--;
  
          location_.move(newX,y);
      }
  
      else if (i==3){
  
          int newX = x++;
  
          location_.move(newX,y);
      }
  
  
  
  }
  
  public String checkMoblity(){
      int x = (int) location_.getX();
      int y = (int) location_.getY();
  
      if(x==-1 || x==5){
          if(y==0 || y==2 || y==4){
              return "drowned";
          }
  
          else return "escaped";
      }
  
      else if(y==-1 || y==5){
          if(x==0 || x==2 || x==4){
              return "drowned";
          }
  
          else return "escaped";
      }
  
      else  return null;
  
  }
  
  }
  </code></pre>
  
  <p>another file:</p>
  
  <pre><code> import java.util.Random;
  
  public class Chase {
  
  public  void playGame(){
  
      Random rand = new Random();
  
  //error
      Cat cat = new Cat("Tom", rand);
      Mouse mouse = new Mouse("Jerry", rand);
  
      do{
          cat.setStartLocation();
          mouse.setStartLocation();
      }while(cat.getLocation()== mouse.getLocation());
  
      String status = Status(cat,mouse);
      boolean end = end(cat, mouse);
  
      do{
          mouse.move();
  
          if(end==false){
          cat.move();
          }
  
      }while(end==false);
  
      if (status == "drowned"){
          System.out.println(mouse.getName() + " drowned!");
      }
  
      else if (status == "escaped"){
          System.out.println(mouse.getName() + " escaped!");
      }
  
      else if (status == "snack"){
          System.out.println(cat.getName() + " got the snack!");
      }
  
  
  }
  
  
  
  public  String Status(Cat cat, Mouse mouse){
      if(mouse.checkMoblity()== "drowned"){
          return "drowned";
      }
  
      else if(mouse.checkMoblity() == "escaped"){
          return "escaped";
      }
  
      else if(mouse.getLocation()==cat.getLocation()){
          return "snack";
      }
  
      else return null;
  }
  
  public  boolean end(Cat cat, Mouse mouse){
      if(mouse.checkMoblity()== "drowned"){
          return true;
      }
  
      else if(mouse.checkMoblity() == "escaped"){
          return true;
      }
  
      else if(mouse.getLocation()==cat.getLocation()){
          return true;
      }
  
      else return false;
  }
  
  
  
  public static void main(String[] args){
      Chase chase = new Chase();
  
  //error
      chase.playGame();
  }
  }
  </code></pre>