Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#ccccFF
public class Example {
  private T a;
  private T b;
  private T[] c;
  private T d;

  public Example(T in){
    a = in;
    b = in;
    c = (T[]) new Object[10];
    d = in;
  }
}

Exceptions

Note that the declaration of a loop counter in a for statement is in violation of this recommendation because the declaration is not on its own line with an explanatory comment about the role of the variable. However, the intent of the loop counter is clear enough from the context in which it is declared to typically not require a comment about the role of the variable.

DCL04-01: Trivial declarations for loop counters , for example, can reasonably be included within a for statement:

...