I wrote this piece of code of simple if statement and the out put is not it should be it gives
What is your Gender? male male The user did not answer the Question.
strong text public static void main(String args[]) {
Scanner userInput = new Scanner(System.in);
System.out.println("What is your Gender?");
String gender = userInput.nextLine();
System.out.println(gender);
if (gender == "Male" || gender == "male") {
System.out.println("Go to Room M1.");
} else if (gender == "Female" || gender == "female") {
System.out.println("Go to Room F1.");
} else {
System.out.println("The user did not answer the Question.");
}
userInput.close();
}