Java Reference
In-Depth Information
3.
Type
Hello
in the Project name field.
■
Note
Be careful to pick meaningful names. I've chosen
Hello
for this example because the first program
we're going to write is one that says
Hello
. One common mistake for new software developers is to choose
names such as
Project1
and
Project2
. It probably won't be long before you can't remember the details of any of
them. Instead, if you're writing a minesweeper game, call your project
Minesweeper
. Then, when you're also
working on an instant messaging program, you can distinguish
Minesweeper
from
InstantMessenger
much more
readily than you can distinguish
Project1
from
Project2
.
4.
Click OK. You can change a number of other options here. However, for our
purposes, the default settings work just fine. You should now have a window
that looks something like the one in Figure 1-3.
Figure 1-3. The main area of the Eclipse IDE.
Creating the Program
Every Java program has one class that is the program's starting point .(often called an entry point). A
class is a bit of code that groups other bits of code together in a particular way. We'll get to classes in the
next chapter. The thing that makes that class special is the existence of the
main
method. A method is a
bit of code that does one particular thing - in this case, it starts the program. We'll cover methods in the
next chapter, too. The
main
method accepts inputs and starts the program. Ever Java program has one
and only one
main
method.