Jtest logo




Contents  Previous  Next  Index

PB.FEB


Avoid "for" statements with empty bodies

Description

This rule flags any "for" statement with an empty body.

"for" statements that are immediately followed by a closing statement (for example, a semicolon) are usually typos.

Example

 package PB;
 
 public class FEB {
     void method () {
         int i;
         for (i = 0; i < 10; ++i) ;
 	     System.out.println (i);
     }
 }

The `println()' will only be executed once when i==11.

Repair

Remove the unnecessary semicolon.


Contents  Previous  Next  Index

ParaSoft logo
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft