For the most part, all personal preferences. I would use the first constructor if its value was independent of other variables. However, setter methods allow you to fulfill certain conditions before changing a variable's value. For instance:
private int x;
public TestClass(int x) {
setX(x);
}
public void setX(int x) {
if (System.currentTimeMillis() & 1 == 0) {
this.x = 5;
} else {
this.x = x;
}
}
setter, , .
, , , , , setter, . , - setter, final .