I've tried everything, but I'm stuck in this loop. I am trying to set the Person1 gender by making the user introduce the String "M" for male or "F" for female, and if the user introduces something else besides those letters, have them introduce it again, but the loop (while(Person1.getGender().equals...) keeps repeating and I can't make it stop. Does it have anything to do with the or (||), or is it something else? Please help me, I'm doing this for programming homework.
Thank you. (BTW, sorry for my bad English. I'm still learning.)
System.out.println("Introduce your name: ");
Person1.setName(input.next());
System.out.printl("\nIntroduce your age: ");
Person1.setAge(input.nextInt());
System.out.println("\nIntroduce your ID: ");
Person1.setID(input.nextInt());
while (
Person1.getGender().equals("M")==false ||
Person1.getGender().equals("F")==false)
{ //This loop keeps repeating no matter what i do.
System.out.println("\nIntroduce your Gender: (M: Male) (F: Female) ");
Person1.setGender(input.next());
}
Syso("\nIntroduce your Weight: (Kg)");
Person1.setWeight(input.nextDouble());