Character types
There is only one primitive Java type
for working with individual characters — the char type.
Examples of char values include:
- 'm'
- ' ' (space)
- '='
- '5'
- 'A'
An example of some code declaring and
initialising a char variable is as follows:
char
carYearLetter = 'A';
Notice the use of single quotation
marks for char literal values. This becomes important when working with strings of
characters that defined using double quotation marks.
A related concept to the char type, is
that of the String class. The relationship
between characters and strings is described in the next unit.
Back
to top
. 
RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg
|