Java Getters and Setters

后端 未结 17 1535
终归单人心
终归单人心 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:05

    Yeah, you are kind of out of luck. Groovy does generate them for you, but no dice in standard java. If you use Eclipse you can generate them pretty easily, as well as generate hashCode() and equals() functions.

提交回复
热议问题