您没有检查double粘贴的代码中的数字是否为 a - 您也不应该这样做。你可以使用类似的东西:Integer.parseInt(...)它接受一个字符串并返回一个整数。然后您可以将该结果存储在一个变量中并将整个谓词替换为:int ageInYears = Integer.parseInt(...) // you'll need to wrap this in a try/catchif(ageInYears >= 72) { //handle the old fogey}