Eclipse has two very simple functions, but it is absolutely very practical!
1. Annotations are very important. In eclipse, you can quickly generate annotations. Right-click the method body to be annotated and choose-source-gernerate element comment (shortcut keys are also available: alt + Shift + J)
After you click it, the following comments are generated, including the parameter comments used by the method.
When you hover the mouse over a non-method body of the class, a comment will be added to the class. The default author is the login user name and can be modified by yourself, as shown below:
2. Code with a good format is often more readable. Sometimes the code downloaded from the internet is too messy and you can use this method to solve it! It is also valid for XML, and the method is to right-click any location-source-format
Before formatting:
After formatting:
After formatting, you must be in a great mood!
Additional: Sometimes the format function of eclipse will automatically wrap the line, and sometimes the code looks uncomfortable, so I checked the information on the Internet:
1. preferences-> JAVA-> code style-> code formatter-> show...
After opening, select the "line wrapping" tab and wrap the line when "maximun line width" specifies the number of columns that are greater than the limit.
2. on the "line wrapping" tab, you can select "line wrapping policy" to specify line breaks for constructors and method bodies.
However, sun's recommended encoding style defaults to 80-column line breaks.
There is a slight deviation between different versions of eclipse. The following is the interface for my actual operation. It is for reference only: (the system profile cannot be modified. You need to create a new one and change the name, can be changed)I changed it to 500.