Completion requirements
This chapter goes into more depth about relational and logical operators. You will have to use these concepts to write complex programs that other people can read and follow.
7. Character Data and Operators
Another primitive data type in Java is the character type, char. A character in Java is represented by a 16-bit unsigned integer. This means that a total of 216 or 65536 different Unicode characters can be represented, corresponding to the integer values 0 to 65535. The Unicode character set is an international standard that has been developed to enable computer languages to represent characters in a wide variety of languages, not just English. Detailed information about this encoding can be obtained at
http://www.unicode.org/
It is customary in programming languages to use unsigned integers to represent characters. This means that all the digits (0,...,9), alphabetic letters (a,...,z,A,...,Z), punctuation symbols (such as . ; , " '' ! -), and nonprinting control characters (LINE FEED, ESCAPE, CARRIAGE RETURN, ...) that make up the computer's character set are represented in the computer's memory by integers. A more traditional set of characters is the ASCII (American Standard Code for Information Interchange) character set. ASCII is based on a 7-bit code and, therefore, defines 27 or 128 different characters, corresponding to the integer values 0 to 127. In order to make Unicode backward compatible with ASCII systems, the first 128 Unicode characters are identical to the ASCII characters. Thus, in both the ASCII and Unicode encoding, the printable characters have the integer values shown in Table 5.13.
|
---|