Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在练习我的java,并试图制作一个简单的计数器,最大翻转,但由于某种原因它没有翻转。有什么建议吗?
if(count++ < max){ click(); }
小心count++。它评估为 的当前值count,然后递增。所以如果count是 3,并且max是 3,count++ > max将返回 false,然后递增count。它看起来像你想要++count的,它增加,然后评估。
count++
count
max
count++ > max
++count