Java's idea shortcut key generates getter and setter, has construction parameters, no construction parameters, rewrites toString method

Foreword:

Reader's Manual (Must Read)

java: when using idea, you will encounter the use of shortcut keys java idea shortcut keys to generate getters and setters, when there are construction parameters and no construction parameters, you can follow my method to operate in Chinese and English

1. Generate getters and setters (1-5):  right click - generate - getters and setters - hold down the Ctrl key, select all with the mouse - ok

2. Generate a constructor with parameters (6-9): Right-click-Generate-Constructor-Hold down the Ctrl key-Select all with the mouse (yellow)-OK
3. Generate a parameterless constructor (10-11):   Right-click-Generate- Constructor - select the major category (blue) - OK

4. Generate and rewrite the toString method (12-13): Right-click-generate-toString()--press and hold the Ctrl key-mouse select all (yellow)-OK

1. Generate getter and setter (1-4)

1. First in the member variable class

2. The cursor should be placed in the last line in {} (to avoid code confusion), right click - generate

3. Choose getters and setters

4. Hold down the Ctrl key and select all these private classes with the mouse - click OK

5. Results

2. Generate construction parameters

6. Similarly, right click on the last line of the class - generate

7. Choose the constructor

8. Hold down the Ctrl key and select all these classes (yellow) with the mouse - click OK

9. Results

 3. Generate a parameterless constructor

10. There are three steps in total. The first two steps are the same as 6.7. The last step is to choose the blue category (blue) - OK.

11. Results

Fourth, rewrite the toString method

12. The first step: use the shortcut key Alt+Insert, select toString

Step 2: Hold down the ctrl key, select the middle yellow class, and click ok

 

13. Results

 =========================================================================

Note: If you think this article is helpful to you, give it a one-click triple link ! ! !

Like, collect and comment, clap your fists!

Guess you like

Origin blog.csdn.net/m0_52861000/article/details/125627695