# Creating a nested class

You can create classes that are enclosed in other types (that is, nested classes).

1. Open the New Java Class wizard.
2. Edit the Source Folder field to indicate in which folder you want the new class to reside. You can either type a path or click Browse to find the folder. If a folder is found for the current selection, that folder appears in the Source Folder field as the container for the new class.
3. Select the Enclosing Type checkbox and type the name of the enclosing type in the Enclosing Type field. You can also click Browse to select the enclosing type for the new class.
4. In the Name field, type a name for the new class. (Optionally, in a 5.0 project, add type parameters enclosed in < and >).
5. Select the desired modifiers by using the Modifiers radio buttons and checkboxes.
6. In the Superclass field, type or click Browse to select a superclass for the new class. (Optionally, in a 5.0 project, add type arguments enclosed in < and >).
7. Click the Add button to add interfaces for the new class to implement. (Optionally, in a 5.0 project, add type arguments enclosed in < and >).
8. If you want to create some method stubs in the new class:
9. - Select the public static void main(String[] args) checkbox if you want the wizard to add the main method to the new class, thus making it a starting point of an application.
   - Select the Constructors from superclass checkbox if you want the wizard to create, in the new class, a set of constructors, one for each of the constructors declared in the superclass. Each of them will have the same number of parameters (of the same types) as the respective constructor from the superclass.
   - Select the Inherited abstract methods checkbox if you want the wizard to generate method stubs for each of the abstract methods that the new class will inherit from its superclass and implemented interfaces.
10. Click Finish when you are done.

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

Java projects

Creating a new Java class
Creating a top-level class
Creating a class in an existing compilation unit

New Java Class wizard