Web design templates - Chapter 3: Using the Basic Building Blocks 49
Chapter 3: Using the Basic Building Blocks 49 Strictly speaking, the meanings of the identifiers in the Java API are not cast in stone. Although you can make up your own meanings for the words like JButtonor JWindow, this isn t a good idea. If you did, you would confuse the dickens out of other programmers, who are used to the standard API meanings for these familiar identifier names. But even worse, when your code assigns a new meaning to an identifier like JButton, you lose any computational power that was created for the identifier in the API code. The programmers at Sun Microsystems did all the work writing Java code to handle buttons. If you assign your own meaning to the word JButton, you re turning your back on all the progress made in creating the API. Checking Out Java Code for the First Time 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. Listing 3-1: The Simplest Java Program class Displayer { public static void main(String args[]) { System.out.println( You ll love Java! ); } }
Every our account comes with web mail client, free virus scanner, free anti-spam tool, free web templates and much more. For complete list of all our virtual web hosting features check our Virtual Web Hosting section.