Hi, whenever I enter y or Y and call the method it should print out OK, but it doesn't it skips all the else if's and executes the last else statement "terminating" any suggestions why?I included the import java.lang.String
public void checkVariable()
{
if(checkString == "y" || checkString == "Y")
{
System.out.println("OK");
}
else if(checkString == "yes" || checkString == "Yes")
{
System.out.println("OK");
}
else if(checkString == "ok" || checkString == "OK")
{
System.out.println("OK");
}
else if(checkString == "sure" || checkString == "Sure")
{
System.out.println("OK");
}
else if(checkString == "why not?" || checkString == "Why not?")
{
System.out.println("OK");
}
else if(checkString == "n" || checkString == "N" || checkString == "no" || checkString == "No")
{
System.out.println("OK");
}
else
{
System.out.println("Terminating");
}
}
Thanks.