Pages

Wednesday, March 14, 2012

Auto Getters, Setters, and Constructors in Eclipse

Retro Eclipse loading screen


Eclipse IDE Shortcut: GETTERS AND SETTERS
Getters: methods that allow you to access information from a class.
Setters: methods that allow you to modify information from a class.

1. Start Eclipse > Navigate to the desired class
2. Right click the editor panel > Hover your mouse over "Source" 
3. Hover over where it says "Generate Getters and Setters..."
4. Select the the variables you wish the create a Getter or Setter for.
5. Press OK or hit Enter

Eclipse IDE Shortcut: CONSTRUCTORS
Constructors are called when an instance of a class is created (it constructs the class essentially).

1. Start Eclipse > Navigate to the desired class
2. Right click the editor panel > Hover your mouse over "Source" 
3. Hover over where it says "Generate Constructors using fields" or "Generate Constructors from superclass"
4. Select the characteristics for the constructor you are making.
5. Press OK or hit Enter.



No comments:

Post a Comment