One of the most repetitive tasks in software development is creating classes. Once again, with NetBeans wizards, creation of classes is very easy and straightforward.
It is necessary to have a project in order to create a class; so, if you are unsure on how to do this, please check the recipes in Chapter 1, Using NetBeans Projects. To help follow this recipe, when creating a project, enter CreatingClasses
as the project name. When creating the project, ensure the Create Main Class option is not selected.
When the Projects explorer shows the CreatingClasses
project, expand the CreatingClasses
node if not yet expanded and perform the following steps:
Right-click on the
CreatingClasses
project, and select New and Java Class….On the New Java Class window, type
Recipe
under the Class Name field.On the Package selection, enter
com.davidsalter.cookbook.creatingclasses
.Click on Finish.
We can see the New Java Class window in the following screenshot: