遇到.equals();

时间:2017-08-26 22:43:27

标签: java debugging

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"。有没有办法可以做到这一点?或者我必须使用不同的方法。

0 个答案:

没有答案