I just read the SUN java code conventions ; a very good document by the way. And I read it
6.3 Initialization: Try to initialize local variables where they are declared. The only reason not to initialize the variable where it is declared, if the initial value depends on some calculations that occur in the first place.
And I was wondering if they have Class variablesthe same sentence or not, for example, I have:
public class NNmatrix {
protected ArrayList<ArrayList<Double>> matrix;
public NNmatrix() {
matrix = new ArrayList<ArrayList<Double>>();
}
public NNmatrix(final ArrayList<ArrayList<Double>> otherMtrx) {
final int rows = otherMtrx.size();
matrix = new ArrayList<ArrayList<Double>>(rows);
for (int i = 0; i < rows; i++) {
this.matrix.add(new ArrayList<Double>(otherMtrx.get(i)));
}
}
}
# variable, ( ), " 2" " 3", # () , .
:
- , ..?
- , , , # @line 3 @ 1?