Creating a Nested (i.e., Inner) Interface

You can create interfaces that are enclosed in other types (i.e., nested interfaces).

1.

Open the New Interface wizard. See Opening the New Interface Wizard

2.

If a folder is found for the current selection, that folder appears in the Folder field as the container for the new interface.

Edit the Folder field as needed to indicate in which folder you want the new interface to reside. You can either type a path or click the Browse button to find the folder.

3.

Check the Enclosing Type box. In the Enclosing Type field, type the name of the enclosing type or click the Browse button to select the enclosing type for the new interface.

4.

In the Name field, type a name for the new interface.

5.

Select the desired access modifier by using the Access Modifiers radio buttons.

  • public
  • default

6.

Check the static box if you want the new interface to be static (only if enclosed in a type).

7.

Click the Add button to add interfaces for the new interface to extend.

8.

Click Finish when you are done.

Note: The new interface is created in the same compilation unit as its enclosing type.