While “!b.equals(x) || !b.equals(y)” is an infinite loop?

前端 未结 1 1541
猫巷女王i
猫巷女王i 2021-01-26 18:25

Hey guys this is my code and what it is doing is going in an loop but what its suppose to do is if the user types in borrow then it will ask the user how much which it does but

1条回答
  •  后悔当初
    2021-01-26 19:00

    You need to change || to && inside while, otherwise the condition is always true. There'll always be at least one of those two values that b is not equal to.

    0 讨论(0)
提交回复
热议问题