How do I generate constructors?
Author: Deron Eriksson
Description: This tutorial describes how to generate constructors in Eclipse.
Tutorial created using: Windows XP || JDK 1.5.0_09 || Eclipse Web Tools Platform 2.0 (Eclipse 3.3.0)
To generate a constructor, I right-click the class in the editor and select Source → Generate Constructor using Fields.
In the 'Generate Constructor using Fields' window, I select to generate a constructor using all three fields in the specified order, and I decide to create a public constructor. I click OK.
Eclipse automatically generates a constructor for my class featuring three parameters to set the three member variables.
(Continued on page 2)