Eclipse usage and Tip 6: automatically generate get and set method 1

Source: Internet
Author: User

In Java classes, except constants declared as static and public, general object data scopes are declared as private. In this way, the attributes of the object will not be changed at will, and debugging will be much more convenient: In the public method of the class, you can see where the attribute value is changed by adding a call stack. Data declared as private is generally not allowed to write some set and get methods. Powerful eclipse provides us with the ability to quickly generate the set and get methods, directly:

Step 1: Right-click the declared class and select Source:

Step 2: Select generate getters and setters:

Step 3: Configure as needed, such as location and order. Select OK:

 

In the previous article, eclipse usage and tips 5: generate instructions 2:

Http://blog.csdn.net/ts1122/article/details/8798127

In the next article, eclipse usage and technique 7: 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.