The first time you look at somebody else’s Java program, you tend to feel a bit
queasy. The realization that you don’t understand something (or many things)
in the code can make you nervous. I’ve written hundreds (maybe thousands) of
Java programs, but I still feel insecure when I start reading someone else’s code.
The truth is that finding out about a Java program is a bootstrapping experience.
First, you gawk in awe of the program.
Then you run the program to see
what it does. Then you stare at the program for a while or read someone’s
explanation of the program and its parts. Then you gawk a little more and run
the program again. Eventually, you come to terms with the program. (Don’t
believe the wise guys who say they never go through these steps. Even the
experienced programmers approach a new project slowly and carefully.)
In Listing 3-1, you get a blast of Java code. (Like all novice programmers,
you’re expected to gawk humbly at the code.) Hidden in the code, I’ve placed
some important ideas, which I explain in detail in the next section. These
ideas include the use of classes, methods, and Java statements.
The Simplest Java Program
class Displayer {
public static void main(String args[]) {
System.out.println(“You’ll love Java!”);
}
}
queasy. The realization that you don’t understand something (or many things)
in the code can make you nervous. I’ve written hundreds (maybe thousands) of
Java programs, but I still feel insecure when I start reading someone else’s code.
The truth is that finding out about a Java program is a bootstrapping experience.
First, you gawk in awe of the program.
Then you run the program to see
what it does. Then you stare at the program for a while or read someone’s
explanation of the program and its parts. Then you gawk a little more and run
the program again. Eventually, you come to terms with the program. (Don’t
believe the wise guys who say they never go through these steps. Even the
experienced programmers approach a new project slowly and carefully.)
In Listing 3-1, you get a blast of Java code. (Like all novice programmers,
you’re expected to gawk humbly at the code.) Hidden in the code, I’ve placed
some important ideas, which I explain in detail in the next section. These
ideas include the use of classes, methods, and Java statements.
The Simplest Java Program
class Displayer {
public static void main(String args[]) {
System.out.println(“You’ll love Java!”);
}
}
No comments:
Post a Comment