How to automatically generate constructors in Eclipse Eclipse is a very good IDE, and I use eclipse to feel very productive when writing Java programs. And there are a lot of quick and easy ways for everyone to use, and can directly generate class files (do not need Javac compilation). Today I would like to introduce you how to build a constructor for a class.
Method One:
I created a class with two private attributes, age and name. Now constructs two constructors, one with no parameters and one with parameters. Right-->source->generate constructors from superclass, create an empty parameter constructor, right-click->source->generate constructors using Fields, create a constructor with parameters.
Method Two: Directly on the Shift+alt+s, and then select generate constructors from superclass or generate constructors using fields, respectively constructs the null parameter and the parameter constructor. (Shanghai Shang School Java Training Group creation, please pay more attention, Java related Technical articles in succession!) )
How to automatically generate constructors in eclipse