In this lesson, we’ll examine the similarities and differences between the String
class and the char
primitive type. Strings are simply sequences of char
s.
We also learn that all char
values have a corresponding int
value. chars are actually stored as numbers! For example, 65 corresponds to ‘A’, 66 corresponds to ‘B’, and so on. We’ll learn about special characters like tabs, quotes, and new lines, and how to store and print these special characters using escape sequences like ‘\n’
Lastly, we learn about the Character class. The Character class provides several useful methods that allow us to manipulate and get information about char values.
Students will be able to…
char
and the class Character
char
values to int
values using castingint
values to char
values using castingchar
valuesThese are all the activities included in the lesson