
2.2 Data Types,Variables,and Constants 49
TABLE 2.4 The Character Data Type
Character Data Type Size in Bytes Minimum Value Maximum Value
char 2 The character encoded as 0000, The character encoded as
the null character FFFF,currently unused
TABLE 2.5 The boolean Data Type
boolean Data Type Possible Values
boolean true
false
Obviously, since the char data type can store only a single character, such as a
K,achar variable is not useful for storing names, titles, or other text data. For
text data, Java provides a String class, which we’ll discuss later in this chapter.
Here are a few declarations of char variables:
char finalGrade;
char middleInitial;
char ...