问题描述
- 为什么这个 总是返回True呀?
-
public void winGame() {
boolean won = true;for (int i = 0; i < count.length; i++) { for (int j = 0; j < count[0].length; j++) { if (count[i][j] != MINE && buttons[i][j].isEnabled()) { won = false; } } } if (won = true) { Window.alert("Win!!!!!!!!"); } } 说won never used 并且总是won=true
解决方案
那就是 count[i][j] != MINE && buttons[i][j].isEnabled() 这句不成立呗。加断点 调试调试,分别取值看看
时间: 2025-01-24 08:23:45