Page 497 - Introduction to Programming with Java: A Problem Solving Approach
P. 497
Figure 11.12 Output produced by the program in Figure 11.11
a unicode hexadecimal value of 0x2200. The maximum value of the inner for loop in Figure 11.11 is 72.
The hexadecimal value of 72 is 4 16 8 0x0048. Thus, the Unicode hexadecimal value of the last
mathematical operator displayed in Figure 11.12 is 0x2200 0x0048 0x2248. Sometimes you can use a
word processor to help you find the Unicode value of the special symbol you want. For example, in Micro-
Apago PDF Enhancer
soft Word, select Insert / Symbol / Mathematical Operators, and then select . Then read the Unicode hex value for the selected symbol from the “Character code” field near the bottom of the Symbol window. You’ll find this also says the Unicode hexadecimal value for the character is 0x2248.
You can find everything that Unicode has to offer by browsing through the http://www Look it up. .unicode.org Web site. If you go there, look for a Code Charts link, and click on it. That should
take you to a page that lets you explore the various sub-tables within the huge Unicode table. Try to find the Basic Latin link. That takes you to the Basic Latin sub-table, which is equivalent to the ASCII table. The sub-table is referred to as Latin because it contains the Latin alphabet—a, b, c, and so on. Visit a few of the other sub-tables to get an idea of what’s available. In every sub-table, you’ll see a set of characters, and for each character, you’ll see its equivalent Unicode value.
There are also several other standards for assigning numbers to characters. Computer applications some- times include translation tables to make conversions between their own character-coding schemes and Uni- code. Be warned however. The translations don’t always work as you might like, and special characters may change in surprising ways when you transfer text with special characters from one application to another.
Summary
• Numerical overflow creates dramatic errors. Whenever there is any doubt about a particular type’s abil- ity to hold a value that might be assigned to it, change to a larger type.
• Floating point numbers have a greater range than integers, but for a given amount of memory, they pro- vide less precision.
• The ASCII character set provides numerical values for the symbols on a standard keyboard.
• Since characters are represented as numbers, ch1 ch2 evaluates to the sum of the ASCII values for
Summary 463
the char variables, ch1 and ch2.