gpt4 book ai didi

java - 错误 : bad operand types for binary operator '||'

转载 作者:行者123 更新时间:2023-11-30 07:13:21 24 4
gpt4 key购买 nike

这是我的声明

while(coord.getRow() || coord.getColumn() != 0)

我基本上希望它在 x 坐标和 y 坐标不为 0 时循环。然后在其中一个等于 0 时停止执行。对象线的行和列都是整数。

如题我收到错误:

error: bad operand types for binary operator '||'

我可以执行一个 while 循环来做这样的事情吗?

最佳答案

while(coord.getRow() != 0 && coord.getColumn() != 0)

代替

while(coord.getRow() || coord.getColumn() != 0)

关于java - 错误 : bad operand types for binary operator '||' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19485219/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com