Java/boolean のバックアップソース(No.1)
- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- バックアップ を表示
- Java/boolean へ行く。
- 1 (2018-02-21 (水) 02:00:41)
- 2 (2018-10-22 (月) 16:53:24)
***よくある間違い [#xba0ba36] |boolean found = true;&BR;if (found = true) {&BR; 中身&BR;}| found それ自身がboolean型 即ち条件式の結果を示すものだから、 if(found) だけで「foundがtrueのとき」を意味する。 また上記のようにすると、foundににtrueを代入しているだけになるので注意。 下のようにifの条件部分に直接放り込んだほうがトラブルが少なくて済む。 |boolean found = true;&BR;if (found) {&BR; 中身&BR;}|