创建类,写上成员变量之后

无参构造方法:
             代码区右键--source--Generate_Constructors from Superclass

                  快捷键:alt+shift+s+c

带参构造方法:

             代码区右键--source--Generate_Constructors using fields

                  ​​​​快捷键:alt+shift+s+c

成对的getXxx()和SetXxx()方法:

            代码区右键--source--Generate Getters and Setters...

                  快捷键:alt+shift+s+c

1.无参构造方法:
             代码区右键--source--Generate_Constructors from Superclass

Ecilpse中构造方法和成对的getXxx()和SetXxx()方法自动生成

图上Generate_Constructors from Superclass中c下面有个下划线,快捷键是alt+shift+s+c

Ecilpse中构造方法和成对的getXxx()和SetXxx()方法自动生成

它的父类是object,点击Generate自动帮你生成无参构造方法

Ecilpse中构造方法和成对的getXxx()和SetXxx()方法自动生成

2.带参构造方法:

             代码区右键--source--Generate_Constructors using fields

Ecilpse中构造方法和成对的getXxx()和SetXxx()方法自动生成

图上Generate_Constructors uisng Fields中o下面有个下划线,快捷键是alt+shift+s+o

Ecilpse中构造方法和成对的getXxx()和SetXxx()方法自动生成

点击Generate自动生成

Ecilpse中构造方法和成对的getXxx()和SetXxx()方法自动生成

3.成对的getXxx()和SetXxx()方法:

            代码区右键--source--Generate Getters and Setters...

Ecilpse中构造方法和成对的getXxx()和SetXxx()方法自动生成

图上Generate Getters and Setters中r下面有个下划线,快捷键是alt+shift+s+rEcilpse中构造方法和成对的getXxx()和SetXxx()方法自动生成

选中select all ->Generate自动生成

 

相关文章:

  • 2021-10-17
  • 2021-04-26
  • 2022-12-23
  • 2021-06-28
  • 2022-12-23
  • 2022-01-05
  • 2021-08-26
猜你喜欢
  • 2021-11-17
  • 2021-07-20
  • 2021-07-13
  • 2022-12-23
  • 2021-04-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案