82 Part II: Writing Your Own Java Programs (Web site management)
82 Part II: Writing Your Own Java Programs Four ways to store whole numbers Java has four different types of whole numbers. The types are called byte, short, int, and long. Unlike the complicated story about the accuracy of types float and double, the only thing that matters when you choose among the whole number types is the size of the number that you re trying to store. If you want to use numbers larger than 127, don t use byte. To store numbers larger than 32767, don t use short. Most of the time, you ll use int. But if you need to store numbers larger than 2147483647, for- sake intin favor of long. (A long numbercan be as big as 9223372036854775807.) For the whole story, see Table 4-1. At the core of the Brickenchicker elevator problem, you ve got whole numbers numbers with no digits beyond the decimal point. When you divide 1,400 by 150, you get 91/3, but you shouldn t take the 1/3 seriously. No matter how hard you try, you can t squeeze an extra 50 pounds worth of Brickenchicker dectuplet onto the elevator. This fact is reflected nicely in Java. In Listing 4-3, all three variables (weightOfAPerson, elevatorWeightLimit, and numberOfPeople) are of type int. An intvalue is a whole number. When you divide one intvalue by another (as you do with the slash in Listing 4-3), you get another int. When you divide 1,400 by 150, you get 9 not 91/ 3. You see this in Figure 4-4. Taken together, the following statements put the number 9 on the computer screen: numberOfPeople = elevatorWeightLimit / weightOfAPerson; out.print(numberOfPeople); Combining Declarations and Initializing Variables Look back at Listing 4-3. In that listing, you see three variable declarations one for each of the program s three intvariables. I could have done the same thing with just one declaration: int weightOfAPerson, elevatorWeightLimit, numberOfPeople; If two variables have completely different types, you can t create both variables in the same declaration. For instance, to create an intvariable named weightOfFred and a doublevariable named amountInFredsAccount, you need two separate variable declarations.
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.