...
In this noncompliant code example, an assignment expression is the controlling expression in an if
statement.:
Code Block | ||
---|---|---|
| ||
public void f(boolean a, boolean b) { if (a = b) { /* ... */ } } |
...
When the assignment of b
to a
is unintended, this conditional block is now executed only when a
is equal to b
.:
Code Block | ||
---|---|---|
| ||
public void f(boolean a, boolean b) { while ( (a == b) && flag ) { /* ... */ } } |
...