Java Getters and Setters

后端 未结 17 1586
终归单人心
终归单人心 2020-12-01 15:27

Is there a better standard way to create getters and setters in Java?

It is quite verbose to have to explicitly define getters and setters for each variable. Is ther

17条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-01 16:17

    With Netbeans, just start typing get or set where the getter/setter is to be replaced and call up auto complete (Ctrl+Space), it'll give you the option to generate the getter or setter. It'll also give you an option to generate a constructor as well.

提交回复
热议问题