Hello, I’m a high-school student taking beginning Java, and I’m currently working on my final project (a simple RPG). It’s going pretty well, except for one part: is there a way to check if a String variable does not equal something? I know this example won’t work, because you can’t use == with Strings to compare two variables (usually), but is there another way to do this? Any suggestions would be greatly appreciated, thanks.
public static void genderE(String gender, int picNum)
{
while ([b]gender != "male" || gender != "female")[/b]
{
System.out.println("You have entered an invalid gender. Please try again:");
gender = In.getString();
}
if (gender.equalsIgnoreCase("male"))
picNum += 0;
else if (gender.equalsIgnoreCase("female"))
picNum += 100;
else
System.out.println("You have entered an invalid gender. Please try again:");
}