Checkstyle doesn't like assignments inside other statements. You could change your for
loop as follows:
for (String line = br.readLine(); line != null; line = br.readLine()) {
// rest of your code
}
سؤال
I need to change this method so that checkstyle will stop complaining at me.
The inner assignment error is in the for each loop. I want the same functionality but without the error. Thanks!
for (String line; (line = br.readLine()) != null;) {
//CODE
}
المحلول
Checkstyle doesn't like assignments inside other statements. You could change your for
loop as follows:
for (String line = br.readLine(); line != null; line = br.readLine()) {
// rest of your code
}