The NetBeans Software
You may have to drum your fingers and wait a while, as it's not the fastest thing in the world.
To start a new project, click on File > New Project from the NetBeans menu at the top. You'll see the following dialogue box appear:
firstproject.Main
If we leave it like that, the Class will have the name Main. Change it to FirstProject:The default location to save your projects appears in the Project Location text box. You can change this, if you prefer. NetBeans will also create a folder with your project name, in the same location. Click the Finish button and NetBeans will go to work creating all the necessary files for you.
When NetBeans returns you to the IDE, have a look at the Projects area in the top left of the screen (if you can't see this, click Window > Projects from the menu bar at the top of the software):
The coding window that appears should look like this (we've changed the author's name):
public class FirstProject {
This is the same name as the java source file in the project window:
FirstProject.java. When you run your programmes, the compiler
demands that the source file and the class name match. So if your
.java file is called firstProject but the class is called
FirstProject then you'll get an error on compile. And all because
the first one is lowercase "f" and the second one uppercase.Note that although we've also called the package firsproject, this is not necessary. We could have called the package someprogramme. So the name of the package doesn't have to be the same as the java source file, or the class in the source file: it's just the name of the java source file and the name of the class that must match.
In the next part, you'll learn about Java comments.
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment