In this recipe, we'll see how we can create properties directly within a class without having to first add fields to the class and then add accessors for the fields.
First we will need to create a new project, so please refer to the recipes in Chapter 1, Using NetBeans Projects, for creating Java projects. To help follow this recipe, when creating a project, enter
CreatingProperties as the project name and ensure that a main class called
com.davidsalter.cookbook.creatingproperties.CreatingProperties is created.
To show how to create properties within a class, let's first create a class to represent a customer and then add some properties to the