JAVA.STMT.FOR.BLOCK
The body of the for statement must be a block surrounded by {and}.
Vulnerability and risk
If you omit the curly braces in the body of a for statement, a careless programming error may occur.
Mitigation and prevention
Use curly braces in the body of a for statement.
Example 1
Copy
                                                    
                                                
                                            public class C18 {
       public void testNGFor(int some_number)
       {
           for (int i = 0; i < some_number; i++) //NG
               i++;
           for (int j = 0; j < some_number; j++) ; //NG
       }
       
       public void testOKFor(int some_number)
       {
           for (int i = 0; i < some_number; i++)
           {
               i++;
           }
           for (int j = 0; j < some_number; j++)
           {
               ;
           }
       }
}