Creating a Package

A Java package is a standard way to organize your classes into separate namespaces. Although you can create classes without packages, doing so is considered bad programming practice. To create a new package, select File → New → Package or click on the New Package icon in the main toolbar (). Enter the package name as org.eclipseguide and click Finish. You can see the results in the Package Explorer, as shown in Figure 13.

The project has grown a package.

Figure 3-3. The project has grown a package.

Tip

If you looked at the project on disk, you would see the Hello directory, a src directory under that, org under that, and eclipseguide under that. A compact form is shown in the Package Explorer as a convenience.

Get Eclipse IDE Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.