If I write the following class:
public class Example { int j; int k; public Example(int j, int k) { j = j; k = k;
Another useful approach (though seldom used) is to declare method parameters final:
The following block will not compile, thus alerting you to the error immediately:
public Example(final int j, final int k) { j = j; k = k; }