I'm trying to have user input where user types a letter and then depends on letter 'IF' statement chooses which fields to display.
What I have now if I type 'p' and 'P' or 'F' or 'f' my 'for' statement still don't understand my input and throws me to 'else' statement.
But why not?
Scanner scanner = new Scanner(System.in);
System.out.print("Employee's Last Name: ");
inputName = scanner.next();
System.out.print("Employment Status (F or P): ");
inputStatus = scanner.next();
if (inputStatus == "F" || inputStatus == "f")
{
// some code
}
else if(inputStatus == "P" || inputStatus == "p")
{
// some code
}
else
{
System.out.println("I don't understand...");
}