Once we've written and run/debugged some of our code, it's generally a good idea to check that the code follows some layout guidelines.
In this recipe, we'll see how we can quickly and easily format the code so that all of our code has a standard layout making it easier for us and others to read.
It is necessary to have a project in order to format the code within it. If you are unsure on how to create a project, please check the recipes in Chapter 1, Using NetBeans Projects. To help follow this recipe, when creating a project, enter
FormattingCode as the project name and ensure that the option to create a main class called
com.davidsalter.cookbook.formattingcode.FormattingCode is selected.