IntelliJ IDEA 2017.1 Help

Creating Java Classes, Interfaces, Enumerations and Annotations

IntelliJ IDEA suggests a simplified way of creating Java classes, interfaces, enumerations or annotations, with all the required infrastructure. The stub generated from a file template is a file with the corresponding extension (.java). This file contains a package statement, a commented header section, and a class declaration.

To create Java class, interface, enumeration or annotation

  1. In the Project tool window, select the destination package. Choose File | New or press Alt+Insert.

    Alternatively, right-click the package and select New from the context menu.

  2. In the New menu, select Java Class.
  3. In the Create New Class dialog:
    1. Type the name of the entity you are creating in the Name field. Don't type the file name extension.

      You can type the name of the package separated by dots in front of the entity you are creating. In this case, IntelliJ IDEA creates the appropriate package structure, generates a file with the specified name and the corresponding extension (.java), and opens this file in the editor.

    2. Select the kind of symbol to be created from the Kind list. Note that you can use the Up and Down arrow keys to browse the contents of this list.
    3. Click OK.

IntelliJ IDEA generates a file with the specified name and the corresponding extension (.java), and opens this file in the editor.

See Also

Last modified: 18 July 2017