MISC.WHILE
A "while" statement should have a block
Description
This rule flags any "while" statement that does not have a block.
It is a good programming practice to add optional block for a "while" statements.
Example
package MISC;
public class WHILE {
public void method (int count) {
while (count++ < 10) // violation
System.out.println ("inside of while");
while while (count-- > 0) {
System.out.println ("inside of while");
}
}
}
Repair
Add a block for each "while" statements.
|