Archive for October, 2007

Zeus web server - 56 Part I: Getting Started When I say

Wednesday, October 31st, 2007

56 Part I: Getting Started When I say things like System.out.printlnis buried inside the API, I m not doing justice to the API. True, you can ignore all the nitty-gritty Java code inside the API. All you need to remember is that System.out.printlnis defined somewhere inside that code. But I m not being fair when I make the API code sound like something magical. The API is just another bunch of Java code. The statements in the API that tell the computer what it means to carry out a call to System.out.printlnlook a lot like the Java code in Listing 3-1. In Java, each statement (like the boxed line in Figure 3-4) ends with a semicolon. Other lines in Figure 3-4 don t end with semicolons, because the other lines in Figure 3-4 aren t statements. For instance, the method header (the line with the word main in it) doesn t directly tell the computer to do anything. The method header announces, Just in case you ever want to do main, the next few lines of code tell you how you ll do it. Every complete Java statement ends with a semicolon. class Displayer { public static void main(String args[]) { System.out.println(”You’ll love Java!”); } } public void println(String s) { ensureOpen(); textOut.write(s); textOut.flushBuffer(); … } The computer calls yourmain method automatically, then… …a statement in yourmain method calls the System.out.println method. 101010000111000… Somewhere inside the JavaAPI… Figure 3-5: Calling the System. out. println method.
We provide special commissions and earns up to $125 us per referral for all website hosting directories. With such big commissions you should immediately sign up for our affiliate program for website hosting directory sites.

Chapter 3: Using the Basic Building Blocks 55 (Paypal web hosting)

Tuesday, October 30th, 2007

Chapter 3: Using the Basic Building Blocks 55 tells the computer to display You ll love Java!This line is known as a statement. In Java, a statement is a direct instruction that tells the computer to do something (for example, display this text, put 7 in that memory location, make a window appear). class Displayer { public static void main(String args[]) { System.out.println(”You’ll love Java!”); } } A statement (a call to the System.out.println method) Figure 3-4: A Java statement. Of course, Java has different kinds of statements. A method call, which I introduce in The Java method, earlier in this chapter, is one of the many kinds of Java statements. Listing 3-3 shows you what a method call looks like, and Figure 3-4 also contains a method call that looks like this: System.out.println( You ll love Java! ); When the computer starts executing this statement, the computer calls a method named System.out.printlninto action. (Yes, in Java, a name can have dots in it. The dots mean something.) To learn the meaning behind the dots in Java names, see Chapter 7. Figure 3-5 illustrates the System.out.printlnsituation. Actually, two methods play active roles in the running of the Displayerprogram. Here s how they work: There s a declaration for a main method. I wrote the mainmethod myself. This mainmethod is called automatically whenever I start running the Displayerprogram. There s a call to the System.out.println method. The method call for the System.out.printlnmethod is the only statement in the body of the mainmethod. In other words, calling the System.out.println method is the only thing on the mainmethod s to-do list. The declaration for the System.out.printlnmethod is buried inside the official Java API. For a refresher on the Java API, see the sections, The grammar and the common names and The words in a Java program, earlier in this chapter.
If you are in search for clan hosting account you just came in to right place. We host many clan websites in almost all popular games like Counterstrike, Call Of Duty and other. More details about our offer you can find inside clan web hosting section.

Email web hosting - 54 Part I: Getting Started Figure 3-3: The

Monday, October 29th, 2007

54 Part I: Getting Started Figure 3-3: The main method. The main method’s headerThe main method (also known as the main method’s declaration) public static void main(String args[]) { System.out.println(”You’ll love Java!”); } class Displayer { } The main method’s body The word main plays a special role in Java. In particular, you never write code that explicitly calls a mainmethod into action. The word main is the name of the method that is called into action automatically when the program begins running. So look back at Figure 3-1. From within JCreator you choose Build.Execute Project to run the Displayerprogram. When the Displayerprogram runs, the computer automatically finds the program s mainmethod and executes any instructions inside the method s body. In the Displayerprogram, the mainmethod s body has only one instruction. That instruction tells the computer to print You ll love Java!on the screen. So in Figure 3-1, You ll love Java!appears in JCreator s General Output pane. None of the instructions in a method is executed until the method is called into action. But, if you give a method the name main, that method is called into action automatically. Almost every computer programming language has something akin to Java s methods. If you ve worked with other languages, you may remember things like subprograms, procedures, functions, subroutines, subprocedures, or PERFORMstatements. Whatever you call it in your favorite programming language, a method is a bunch of instructions collected and given a new name. How you finally tell the computer to do something Buried deep in the heart of Listing 3-1 is the single line that actually issues a direct instruction to the computer. The line, which is highlighted in Figure 3-4,
Please check java servlet web hosting services, here you will find professional-grade java servlet web hosting with the best prices.

Chapter 3: Using the Basic Building Blocks 53 (Graphic web design)

Sunday, October 28th, 2007

Chapter 3: Using the Basic Building Blocks 53 Listing 3-3: A Method Call FixTheAlternator(junkyOldFord); Don t scrutinize Listings 3-2 and 3-3 too carefully. All the code in Listings 3-2 and 3-3 is fake! I made up this code so that it looks a lot like real Java code, but it s not real. What s more important, the code in Listings 3-2 and 3-3 isn t meant to illustrate all the rules about Java. So, if you have a grain of salt handy, take it with Listings 3-2 and 3-3. Now that you have a basic understanding of what a method is and how it works, you can dig a little deeper into some useful terminology: If I m being lazy, I refer to the code in Listing 3-2 as a method. If I m not being lazy, I refer to this code as a method declaration. The method declaration in Listing 3-2 has two parts. The first line (the part with FixTheAlternatorin it, up to but not including the open curly brace) is called a method header. The rest of Listing 3-3 (the part surrounded by curly braces) is a method body. The term method declaration distinguishes the list of instructions in Listing 3-2 from the instruction in Listing 3-3, which is known as a method call. A method s declaration tells the computer what happens if you call the method into action. A method call (a separate piece of code) tells the computer to actually call the method into action. A method s declaration and the method s call tend to be in different parts of the Java program. The main method in a program Figure 3-3 has a copy of the code from Listing 3-1. The bulk of the code contains the declaration of a method named main. (Just look for the word main in the code s method header.) For now, don t worry about the other words in the method header the words public, static, void, String, and args. I explain these words in the next several chapters. Like any Java method, the mainmethod is a recipe. How to make biscuits: Heat the oven. Roll the dough. Bake the rolled dough. or How to follow the main instructions for a Displayer: Print You ll love Java! on the screen.
You need web hosting, easy to use web template and great support. What else could I ask for?All of our reseller accounts include free web hosting templates just check web hosting templates for more information.

52 Part I: Getting Started (Web hosting asp) The Java method

Saturday, October 27th, 2007

52 Part I: Getting Started The Java method You re working as an auto mechanic in an upscale garage. Your boss, who s always in a hurry and has a habit of running words together, says, FixTheAlternator on that junkyOldFord. Mentally, you run through a list of tasks. Drive the car into the bay, lift the hood, get a wrench, loosen the alternator belt, and so on. Three things are going on here: You have a name for the thing you re supposed to do. The name is FixTheAlternator. In your mind, you have a list of tasks associated with the name FixTheAlternator. The list includes Drive the car into the bay, lift the hood, get a wrench, loosen the alternator belt, and so on. You have a grumpy boss who s telling you to do all this work. Your boss gets you working by saying, FixTheAlternator. In other words, your boss gets you working by saying the name of the thing you re supposed to do. In this scenario, using the word method wouldn t be a big stretch. You have a method for doing something with an alternator. Your boss calls that method into action, and you respond by doing all the things in the list of instructions that you ve associated with the method. If you believe all that (and I hope you do), then you re ready to read about Java methods. In Java, a method is a list of things to do. Every method has a name, and you tell the computer to do the things in the list by using the method s name in your program. I ve never written a program to get a robot to fix an alternator. But, if I did, the program may include a FixTheAlternatormethod. The list of instructions in my FixTheAlternatormethod would look something like the text in Listing 3-2. Listing 3-2: A Method Declaration void FixTheAlternator() { DriveInto(car, bay); Lift(hood); Get(wrench); Loosen(alternatorBelt); … } Somewhere else in my Java code (somewhere outside of Listing 3-2), I need an instruction to call my FixTheAlternatormethod into action. The instruction to call the FixTheAlternatormethod into action may look like the line in Listing 3-3.
Thailand is divided into 75 provinces , which are gathered into 5 groups of provinces by location. There are also 2 special governed districts: the capital Bangkok and Pattaya. However Pattaya is still part of Chonburi Province. Some Thai people still count Bangkok as one province, making Thailand a 76-province country.All our thai web hosting accounts have spam filter, virus scanner and frontpage extensions preinstalled. Check more in Thai Web Hosting section.

Chapter 3: Using the Basic Building Blocks 51 (Java web server)

Friday, October 26th, 2007

Chapter 3: Using the Basic Building Blocks 51 The Java class Because Java is an object-oriented programming language, your primary goal is to describe classes and objects. (If you re not convinced about this, read the sections on object-oriented programming in Chapter 1.) On those special days when I m feeling sentimental, I tell people that Java is more pure in its object-orientation than most other so-called object-oriented languages. I say this because, in Java, you can t do anything until you ve created a class of some kind. It s like being on Jeopardy!; hearing Alex Trebec say, Let s go to a commercial; and then interrupting him by saying, I m sorry, Alex. You can t issue an instruction without putting your instruction inside a class. In Java, the entire program is a class. I wrote the program, so I get to make up a name for my new class. I chose the name Displayer, because the program displays a line of text on the computer screen. That s why the code in Listing 3-1 starts with class Displayer. (See Figure 3-2.) The entire program class Displayer { public static void main(String args[]) { System.out.println(”You’ll love Java!”); } } Figure 3-2: A Java program is The class Displayer a class. The first word in Listing 3-1, the word class, is a Java keyword. (See the section The words in a Java program, earlier in this chapter.) No matter who writes a Java program, the word classis always used the same way. On the other hand, the word Displayerin Listing 3-1 is an identifier. I made up the word Displayerwhile I was writing this chapter. The word Displayeris the name of a particular class the class that I m creating by writing this program. The Java programming language is case-sensitive. This means that if you change a lowercase letter in a word to an uppercase letter, you change the word s meaning. Changing case can make the entire word go from being meaningful to being meaningless. In the first line of Listing 3-1, you can t replace classwith Class. If you do, the whole program stops working.
We provides quality the CPanel Web Hosting. All our web hosting plans regular, business and expert are competitively priced and unsurpassed in reliability, uptime, and quality of service.

Business web hosting - 50 Part I: Getting Started To see the

Thursday, October 25th, 2007

50 Part I: Getting Started To see the code of Listing 3-1 in the JCreator work area, follow these steps: 1. Open the Chapter03 workspace and, within that workspace, make Listing0301 the active project. (See Chapter 2 for details.) In the File View pane s tree, the name Listing0301is set in boldface. Under Listing0301, you see a branch labeled Displayer.java. 2. Double-click the Displayer.java branch in the File View pane s tree. JCreator s Editor pane appears on the right side of the work area. The Editor pane contains the code in Listing 3-1. After following the first step, you can run the code in Listing 3-1 by choosing Build.Compile Project, and then choosing Build.Execute Project. (See Chapter 2 for details.) When you run the program from Listing 3-1, the computer displays You ll love Java!(See Figure 3-1.) Now, I admit that writing and running a Java program is a lot of work just to get You ll love Java!to appear on somebody s computer screen, but every endeavor has to start somewhere. Figure 3-1: Running the program in Listing 3-1. After following this section s steps, you may see a lot more than just You ll love Java!in JCreator s General Output pane. The General Output pane may display previous runs (runs of some examples from Chapter 2) in addition to this most recent Displayer.javarun. To dispose of previous runs, start right-clicking the General Output pane. Then, in the resulting context menu, select Clear. In the following section, you do more than just run the program and admire the program s output. After you read the following section, you actually understand what makes the program in Listing 3-1 work. Understanding a Simple Java Program This section presents, explains, analyzes, dissects, and otherwise demystifies the Java program shown previously in Listing 3-1.
Please check our cheap domain web hosting services, our secret is fast and stable servers, dedicated 24/7 customer support, and many useful FREE bonuses.

Web design templates - Chapter 3: Using the Basic Building Blocks 49

Wednesday, October 24th, 2007

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.

48 Part I: Getting Started The word Sam (Web hosting account)

Wednesday, October 24th, 2007

48 Part I: Getting Started The word Sam is like a Java identifier because Sam is a name for a particular person. Words like Sam, Dinswald, and McGillimaroo don t come prepacked with meaning in the English language. These words apply to different people depending on the context and become names when parents pick one for their newborn kid. Now consider the sentence Julius Caesar is a person. If you utter this sentence, you re probably talking about the fellow who ruled Rome until the Ides of March. Although the name Julius Caesar isn t hard-wired into the English language, almost everyone uses the name to refer to the same person. If English were a programming language, the name Julius Caesar would be an API identifier. So here s how I, in my own mind, divide the words in a Java program into categories: Keywords: A keyword is a word that has its own special meaning in the Java programming language, and that meaning doesn t change from one program to another. Examples of keywords in Java include if, else, and do. The Cheat Sheet in the front of this book has a complete list of Java keywords. The JCP committee members, who have the final say on what constitutes a Java program, have chosen all Java s keywords. If you think about the two parts of Java, which I discuss in The grammar and the common names section earlier in this chapter, the Java keywords belong solidly to the Language Specification. Identifiers: An identifier is a name for something. The identifier s meaning can change from one program to another, but some identifiers meanings tend to change more than others. Identifiers created by you and me: As a Java programmer (yes, even as a novice Java programmer), you create new names for classes and other things that you describe in your programs. Of course, you may name something Prime, and the guy writing code two cubicles down the hall can name something else Prime. That s okay because Java doesn t have a predetermined meaning for the word Prime. In your program, you can make Primestand for the Federal Reserve s prime rate. And the guy down the hall can make Primestand for the bread, roll, preserves, and prime rib. A conflict doesn t arise, because you and your co-worker are writing two different Java programs. Identifiers from the API: The JCP members have created names for many things and thrown at least 3,000 of these names into the Java API. The API comes with each version of Java, so these names are available to anyone who writes a Java program. Examples of such names are String, Integer, JWindow, JButton, JTextField, and File.
Need a managed web hosting provider to help maintain your website? Our web hosting service is the preferred choice of thousands of demanding customers.

Web proxy server - Chapter 3: Using the Basic Building Blocks 47

Tuesday, October 23rd, 2007

Chapter 3: Using the Basic Building Blocks 47 No one knows all there is to know about the Java API. If you re a Java programmer who frequently writes programs that open new windows, you know how to use the API Frameclass. If you seldom write programs that open windows, the first few times you need to create a window, you can look up the Frameclass in the API documentation. My guess is that if you took a typical Java programmer and kept that programmer from looking up anything in the API documentation, the programmer would be able to use less than 2 percent of all the tools in the Java API. Sure, you may love the For Dummies style. But unfortunately, Java s official API documentation isn t written that way. The API documentation is both concise and precise. For some help deciphering the API documentation s language and style, see this book s Web site. In a way, nothing about the Java API is special. Whenever you write a Java program even the smallest, simplest Java program you create a class that s on par with any of the classes defined in the official Java API. The API is just a set of classes and other tools that were created by ordinary programmers who happen to participate in the official JCP the Java Community Process. Unlike the tools that you create yourself, the tools in the API are distributed with every version of Java. (I m assuming that you, the reader, are not a participant in the Java Community Process. But then, with a fine book like Java For Dummies, 4th Edition, one never knows.) If you re interested in the JCP s activities, visit www.jcp.org. The folks at the JCP don t keep the Java programs in the official Java API a secret. If you want, you can look at all these programs. When you install Java on your computer, the installation puts a file named src.zipon your hard drive. You can open src.zipwith your favorite unzipping program. There, before your eyes, is all the Java API code. The words in a Java program A hard-core Javateer will say that the Java programming language has two different kinds of words: keywords and identifiers. This is true. But the bare truth, without any other explanation, is sometimes misleading. So I recommend dressing up the truth a bit and thinking in terms of three kinds of words: keywords, identifiers that ordinary programmers like you and me create, and identifiers from the API. The differences among these three kinds of words are similar to the differences among words in the English language. In the sentence Sam is a person, the word person is like a Java keyword. No matter who uses the word person, the word always means roughly the same thing. (Sure, you can think of bizarre exceptions in English usage, but please don t.)
We feature a web hosting shopping cart and live support solution. Just try our web hosting shopping cartwhich provides a secure way of obtaining payments through your website.