- On the main menu, choose . Alternatively, right-click the editor and choose Generate on the context menu, or use Alt+InsertControl N; Control Enter keyboard shortcut.
- In the pop-up list that is displayed in the editor, select Constructor option.
- If the class in question contains fields,
IntelliJ IDEA
suggests you to select the fields to be
initialized by constructor. In the Choose Fields to Initialize by Constructor dialog, select the
desired fields.
Tip
Use CtrlControl and ShiftShift keys for multiple selection.
- Click OK.
Example
public class MyClass { int aInteger; double bDouble; public MyClass(int myAIntegerParam, double myBDoubleParam) { aInteger = myAIntegerParam; bDouble = myBDoubleParam; } }

