System.out.println("What color are your eyes?");
Scanner question2 = new Scanner(System.in);
String eye_color = question2.nextLine();
if(eye_color.equals("green", "blue", "hazel", "brown", "amber")) {
System.out.println("So pretty!");
}
else {
System.out.println("Yeah right, what are you, an alien or something?");
}
我希望用户输入不受大小写限制,例如:" Green" vs" green"。有没有办法可以做到这一点?或者我必须使用不同的方法。