Generating Getters and Setters in Eclipse
I am taking Software Development with Java this semester, so not only am I learning a new language, but a new IDE. Eclipse is one of the most popular of the Java Integrated Development Environments.
There is a nice feature in Eclipse that saves a lot typing. It is the Generate Getters and Setters… option on the Source menu.
In the lab we did in class last week there were three main variables.
In Eclipse, go to the Source menu and select Generate Getters and Setters…
In the Getters and Setters dialog, select which fields you want to create the getter/setter for. In this case, I want all three, so I click the [Select All] button and then click [ok].
Magically, all of the getters and setter code is generated for you.
This works well for straight forward variables. I’m sure it is not the best approach for more advanced situations, but it sure saves a lot of typing.![]()
–
^..^

