 Here's the outline of a program we want to write. It asks a yes or no question and processes the user's response. What you see here is called pseudocode. It's part English, part Java. In order to write this program, we need to learn how to read strings for input and how to get the first letter of the string so that we can compare it against the why for yes and n for no. To read a string from the keyboard, you use the next line method as shown here. It reads everything up to the next new line, which was provided when you pressed the Enter key. The book also mentions the next method, which reads up to the next whitespace character. This is useful for reading input one word at a time. Once we have the string, we need to get the first character. To get a specific character from a string, we use the charAt method and give an index number that tells which character we want. The first character in a string has an index number of zero, not number one. For this string, welcome to Java. Calling charAt zero for the message gives back the letter w. CharAt five of the message gives us back the letter m. And if we go beyond the end of the string, Java gives a runtime error. Notice that 15 is out of bounds. Even though there are 15 characters in the string, they're numbered zero through 14. Our last valid index number is 14, not 15. This is a source of many errors when people are just starting out losing strings in Java, by the way. Now that we know this, let's put it together into our program. We prompt the user and read the next line of input into a string. Sometimes users will enter an extra blank before they start their answer, especially if your cursor is too close to the prompt. So we'll use trim to get rid of the spaces and put that back into our answer variable. We're looking for an uppercase y for yes and an uppercase n for no. So we'll convert our answer to uppercase and reassign that to answer. Now we need the first letter. We take the character at index zero of the answer and assign it to a variable named yes or no. If that character is a capital Y, we print out one response. Otherwise, if that letter was a capital N, we print a different response. Otherwise, it's not either a yes or a no, a Y or an N, and we print out this response. Let's run this program several times to see it in action. If we type a capital Y, we get the yes response. Let's put some spaces in and type the word nope, which begins with the letter N, and we get that response. And if we put in something like I don't know, we get the response that the answer wasn't understood. And that's our program that reads strings from the keyboard and uses the char at method to extract specific characters from that string.