...
Exceptionally, it is permitted to use the assignment operator in conditional expressions when the assignment is not the controlling expression (that is, the assignment is a subexpression), as shown in the following compliant example:
Code Block | ||
---|---|---|
| ||
public void app_ex(BufferedReader reader) throws IOException{ String line; BufferedReader reader = // Initialize while ((line = reader.readLine()) != null) { // ... work with line } } |
Related Guidelines
Likely Incorrect Expression [KOA] | |
CWE-480, Use of incorrect operator |
...