When this code is run it will continue to run even if you enter "y" in the if-else tree. How can I fix it so it does its task, which is to tell you how to fix a simple router issue?
import java.util.*;
public class WifiTest
{
public static void main(String [] args){
//Set up the global variables and such
String input;
Scanner scanner = new Scanner (System.in);
//Do We need to fix the connection?
System.out.println("Is your wifi bad? y/n: ");
input = scanner.nextLine();
//If ELSE TREE
if (input == "n"){
System.out.println("There is no problem");
}
else {
System.out.println("Reset and reboot the Computer, did it fix it?: y/n");
input = scanner.nextLine();
if (input == "y") {
System.out.println("Now it is fixed");
}
else {
System.out.println("Reboot the Router and try again, did that fix the problem? y/n : ");
input = scanner.nextLine();
if (input == "y"){
System.out.println("Now it is fixed");
}
else {
System.out.println("Make sure the cables between the router a modem are firm, did that fix it? y/n: ");
input = scanner.nextLine();
if (input == "y"){
System.out.println("Now it is fixed");
}
else{
System.out.println("Move the router to a new location, did that fix the problem? y/n: ");
input = scanner.nextLine();
if (input == "y"){
System.out.println("Now it is fixed");
}
else{
System.out.print("Get a New Router");
}
}
}
}
}
}
}