String-Conditionals in a Java While Loop

后端 未结 3 1430
死守一世寂寞
死守一世寂寞 2021-01-21 18:25

I\'m trying to prompt the user to give me one of three strings: \"Amsterdam,\" \"Lexington,\" and \"Madison.\" If the user doesn\'t enter one of those strings, they should be re

3条回答
  •  不知归路
    2021-01-21 19:30

    Refer to De-Morgan's laws:

    (NOT a) OR (NOT b)
    

    is actually

    NOT (a AND b)
    

    You need to have && instead of ||.

提交回复
热议问题