Genero obj=new Genero();
int swG=0;
while(swG==0) {
System.out.print("Genero\nM : Masculino\nF : Femenino\n>>");
obj.setTipoGenero(entrada.next().charAt(0));
if ((obj.getTipoGenero() != 'm') || (obj.getTipoGenero() != 'M') ||
(obj.getTipoGenero() != 'f') || (obj.getTipoGenero() != 'F')) {
System.out.println("Seleccione la opcion correcta ");
}else {
swG=1;
}
}
My intention for the following fragment of code is that it captures a char either M or F according to the case and if it is different from 'm' or 'M' or 'f' or 'F' I will ask again since it is not the correct one for which it is the cycle and if it is correct then the swG is ignited and it leaves the cycle and follows with the flow of the code, that happens with the code?