Best practice for parameter naming in Java constructors and simple setters
问题 Is there a standard acceptable convention for parameters in Java to straightforward constructors and setters? (I've seen the answer for C++, but practices are often different between the two communities) Suppose that I have a class C with a foo field. I have commonly seen the following three options: 1) Use the actual field name with an underscore: public C(Type foo_) { foo = foo_; } public void setFoo(Type foo_) { foo = foo_; } 2) Use the actual field name, just use "this" in setting: public