public boolean end(Cat cat, Mouse mouse){
String d="drowned";
String e="escaped";
String s=mouse.checkMoblity();
System.out.println(s);
// error next line
if(s.equals(d)){
return true;
}
else if(s.equals(e)){
return true;
}
else if(mouse.getLocation()==cat.getLocation()){
return true;
}
else return false;
}
This is part of my code. When I tried to debug it, it gave me an error on the equals method. I don't know how to fix it.
When I compile..
nullException in thread "main" java.lang.NullPointerException at Chase.end(Chase.java:93) at Chase.playGame(Chase.java:23) at Chase.main(Chase.java:115)