Eclipse Usage and Tricks VI: automatic generation of Get and set methods 1

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.