In Java classes, the general object data scope is declared private, except that the constants are declared as static and public. Doing so protects the object's properties from being arbitrarily changed, and it can be handy when debugging: a large call stack in the class's public method can see where the property value is changed. Data that is declared as private can generally be avoided by writing set and get methods. The powerful eclipse has provided us with the ability to quickly generate set and get methods, directly above:
Step one: In the declared class, right-click and select Source:
Step two: Select Generate Getters and Setters:
Step three: Configure as needed, such as location, order, etc., in the selection of OK:
Previous article, Eclipse Usage and tricks five: build instructions in document 2:
http://blog.csdn.net/ts1122/article/details/8798127
Next article, Eclipse Usage and tricks seven: automatically generate get and set Method 2:
http://blog.csdn.net/ts1122/article/details/8893263