CS 106A, Lecture 9 - Problem-Solving with Strings
Exercises: Arrays public static void main(String[] args) { of the following questions, identify whether or not the given Java program is correct by.
Part of the document
This document is copyright (C) Stanford Computer Science and Marty Stepp, licensed under Creative Commons Attribution 2.5 License. All rights reserved.Based on slides created by Keith Schwarz, Mehran Sahami, Eric Roberts, Stuart Reges, and others.CS 106A, Lecture 9Problem-Solving with Stringssuggested reading:Java Ch. 8.5
2Learning Goals•Be able to write string algorithms that operate on each character. •Be able to build up new strings from existing strings using built-in String methods.
3Plan For Today•Recap: Characters and Strings•Looping over Strings•Practice: Reversing a String•Practice: Palindromes•Practice: Caesar Cipher
4Plan For Today•Recap: Characters and Strings•Looping over Strings•Practice: Reversing a String•Practice: Palindromes•Practice: Caesar Cipher
5Text Processing
6CharA charis a variable type that represents a single character or "glyph".charletterA= 'A';charplus = '+';charzero = '0';charspace = ' ';charnewLine= '\n';chartab = '\t';charsingleQuote= '\'';charbackSlash= '\\';
7CharUnder the hood, Java represents each charas an integer(its "ASCII value"). •Uppercase letters are sequentially numbered•Lowercase letters are sequentially numbered•Digits are sequentially numberedcharuppercaseA= 'A';// Actually 65charlowercaseA= 'a';// Actually 97charzeroDigit= '0';// Actually 48