Hour 6. Using Strings to Communicate
In the film The Piano, Holly Hunter portrays Ada, a young Scottish woman who marries badly. A mute since the age of six, Ada can only express herself fully by playing her prized possession, a piano.
Like Ada, your computer programs are capable of quietly doing their work and never stopping for a chat—or piano recital—with humans. However, if The Piano teaches us anything, it is that communication ranks up there with food, water, and shelter as an essential need. (It also teaches us that the actor Harvey Keitel has a lot of body confidence, but that's a matter for another book.)
Java programs don't have access to a piano. They use strings as the primary means to communicate with users. Strings are collections of text—letters, numbers, punctuation, and other characters. During this hour, you will learn all about working with strings in your Java programs. The following topics will be covered:
Using strings to store text Displaying strings in a program Including special characters in a string Pasting two strings together Including variables in a string Comparing two strings Determining the length of a string Changing a string to upper- or lowercase
|