我设置的while循环有什么问题?
String animal;
animal = user_input.next();
animal = animal.toLowerCase();
while ((animal != "c") && (animal != "d")) {
System.out.println("Invalid input, please enter c for a cat or d for a dog");
animal = user_input.next();
animal = animal.toLowerCase();
}
if (animal == "c") {
System.out.println("you have a cat");
} else {
System.out.println("you have a dog");
}