M/F 2:30-3:20 |
CS 1130: Transition to OO Programming Spring 2016 |
||||||||||||||||||||||||||||||||||||||||||||||
Main
About: Overview Announcements Staff Consultants Calendar Materials: Texts DrJava Terminology Lectures: In-Class Web-Based VideoNote Assessment: Grading Assignments Labs Resources: CMS Piazza (link) Piazza (about) Java API Style Guide Academic Integrity |
Type charOverviewThe values of type
Literals of
type
Try typing
The table below lists four characters that are written using the escape character. To see others, look at page 225 of Gries/Gries.
You will see how the new-line character is used in the next lecture, on Strings. Representation of characters: ASCII and UnicodeYou don't have to read the information below on the representation of characters and Unicode. However, it will give you a sense of history and help you understand how inclusive type char is with respect to the world's languages. Representation of charactersIn the 1960's (and before, in some places), characters were
represented in a 7-bit format known as ASCII (American Standard Code for
Information Interchange). This code had representations of small and capital
letters, many other characters that you find on your keyboard (e.g. But there are many other alphabets besides the one we use in the United States —Russian, Finnish, Greek, Japanese, Persian, and so forth, to say nothing of Chinese. A truly international code would allow characters from all these alphabets. In 1991, the Unicode Consortium was created to develop a 16-bit code that would include all alphabets. The outcome of their work was the Unicode Standard, which is now in use in many programming languages, including Java. The ultimate reference for Unicode is the website www.unicode.org/. To get a simpler and shorter glimpse of Unicode, turn to lesson page 6-5 of the CD ProgramLive. Writing unicode representations in JavaIn Java, you can write the character 'A' as
the character literal
|