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 Creating a Java project using Wizard recipe. However, when naming the project, enter CreatingClasses
.
When the Projects tab shows the CreatingClasses project, expand the CreatingClasses node, if not yet expanded.
Even though NetBeans will create a main class, we will create another one:
The class is created relative to the path of the right-click. Having said that, this example shows that it is also possible to create packages during class creation.
By appending a dot (.) as a suffix, the IDE will create a Java class and a package. In this case, package creatingclasses.my
and a class called MyClass.
The class created by the IDE is a very basic one. Added by the IDE are comments and package path, along with the class declaration.
3.144.10.69