When I input any valid option (A,B,C) the if statement thinks that option is anything but A, B, or C, and will lead into a continuous loop.
package other;
import java.util.Scanner;
public class Menu implements InterfaceMenu{
private String option;
public void greeting(){
System.out.println("This program will use the Pythagorean Theorem");
System.out.println("to calculate a missing side.\n");
System.out.println("Choose an option!\n");
System.out.println("Choose Option A for missing side c");
System.out.println("Choose Option B for missing side b");
System.out.println("Choose Option C for missing side a\n");
}
public String optionGet(){
System.out.print("Choose an option: ");
Scanner ad = new Scanner(System.in);
option=ad.next().toUpperCase();
if( (option=="A") || (option=="B") || (option=="C") ){
ad.close();
}
else{
optionGet();
}
return option;
}
}