I have been trying to figure out a way to create a boolean to determine which biome the user chose based on their input using a scanner. But I have not been able to find a way to implement it. I have tried to use boolean return methods but I kept on getting null or the exact opposite biome I was trying to go for.
File: game.java
public boolean isPlains() {
if (biome == "Plains") {
return true;
} else {
return false;
}
}
public boolean isTundra() {
if (biome == "Tundra") {
return true;
} else {
return false;
}
}
File: phase.java
public class phase extends game{
public void battle() {
game gm = new game();
if (isPlains() == true) {
System.out.println("Hello");
} else {
System.out.println("Bye");
}
}
}
Above is the test run I've tried to run, but whenever I try and run the code it seems to output the opposite I ask it to. I tried flipping it around but it seems to do the same thing. I am trying to use the isPlains/isTundra methods from game.java to determine whether to print hello or bye from phase.java.