The following code won't run the way it's supposed to. The output is always "That isn't a valid answer!"
The code that I'm referring to is as follows:
System.out.println("Should you move along the road or continue through the forest?");
String anw = scan.next();
if (anw == "forest") {
System.out.println("You decide to go to the forest, it's dark and creepy but it can't hurt, right?");
} else if (anw == "road") {
System.out.println("You decided to go along the road and hope to find something, anything, there.");
} else {
System.out.println("That isn't a valid answer!");
}
Any help will be more than appreciated, thank you!