I have been developing Java as a hobby for the last 4 years and I am interested in the convention for Java Bean setters.
If I use Eclipse to generate my Setters I get:
private String var;
public void setVar(String var){
this.var = var;
}
Now I understand how that works but to me (being a developer of old) having two variables with the same name but identifying different objects is confusing. I find if you misspell the parameter variable, e.g bar it still compiles but doesn't work;
My inclination is to use:
private String var;
public void setVar(String varp){
var = varp;
}
Can anyone explain are there any efficiencies or advantages of either method.