110 Part II: Writing Your Own Java Programs (Php web hosting)
Friday, December 21st, 2007110 Part II: Writing Your Own Java Programs You can use all Java s comparison operators to compare numbers and characters. When you compare numbers, things go pretty much the way you think they should go. But when you compare characters, things are a little strange. Comparing uppercase letters with one another is no problem. Because the letter B comes alphabetically before H, the condition B < H is true. Comparing lowercase letters with one another is also okay. What s strange is that when you compare an uppercase letter with a lowercase letter, the uppercase letter is always smaller. So, even though Z < A is false, Z < a is true. Under the hood, the letters A through Z are stored with numeric codes 65 through 90. The letters a through z are stored with codes 97 through 122. That s why each uppercase letter is smaller than each lowercase letter. Be careful when you compare two numbers for equality (with ==) or inequality (with !=). After doing some calculations and obtaining two doublevalues or two floatvalues, the values that you have are seldom dead-on equal to one another. (The problem comes from those pesky digits beyond the decimal point.) For instance, the Fahrenheit equivalent of 21 degrees Celsius is 69.8, and when you calculate 9.0 / 5 * 21 + 32by hand, you get 69.8. But the condition 9.0 / 5 * 21 + 32 == 69.8turns out to be false. That s because, when the computer calculates 9.0 / 5 * 21 + 32, it gets 69.80000000000001, not 69.8. Comparing objects When you start working with objects, you find that you can use ==and !=to compare objects with one another. For instance, a button that you see on the computer screen is an object. You can ask whether the thing that was just mouse-clicked is a particular button on your screen. You do this with Java s equality operator. if (e.getSource() == bCopy) { clipboard.setText(which.getText()); To find out more about responding to button clicks, read Chapter 16 on this book s CD-ROM. The big gotcha with Java s comparison scheme comes when you compare two strings. (For a word or two about Java s Stringtype, see the section about reference types in Chapter 4.) When you compare two strings with one another, you don t want to use the double equal sign. Using the double equal sign would ask, Is this string stored in exactly the same place in memory as that other string? That s usually not what you want to ask. Instead, you usually want to ask, Does this string have the same characters in it as that other
CGI is used because it is far better and more physical than other ways , such as constructing miniatures for effects shots or hiring a cheap deal of extras for crowd scenes, and because it allows the creation of images that would not be feasible using any other technology.Check fore more details under our cgi web hosting section.