# Creating a new class in an existing compilation unit

An alternative way to create a new class is to add it to an existing compilation unit.

1. In the Package Explorer, double-click a compilation unit to open it in an editor.
2. Type the code for the class at the desired position in the compilation unit.

Java projects

Creating a new Java class
Creating a top-level class
Creating a nested class
Renaming a class, field, or interface
Renaming a compilation unit
Setting execution arguments

Package Explorer