READING CHAPTER 9 SECTION 2 "Strings" - string - sequence of characters that is treated as a single value - represented in Java with the String class - charAt method - takes an integer - returns the character at that position in the string - 0-based indexing - length method - last character is length - 1 - String is an object, so String variables are references - value of a variable X is a reference to an object of class Y - X is a Y object - X is an instance of Y - create a new String instance using the method new - String is the only class that allows primitive-style shorthand for creating new instances - toUpperCase method - String instance method - returns a new String which is the original String in all upper case - does not alter the original String - out-of-bound exception - use short-circuit evaluation to avoid - equals method - equalsIgnoreCase method - compareTo method - instance method - takes another String as an argument - returns an integer: 0 if they are equal, a negative number if str1 < str2, and a positive number if str1 > str2 - exact numerical value determined by Unicode lexicographic value - substring method - takes two integer arguments: beginIndex and endIndex - returns the piece of the String including the beginIndex, but excluding the endIndex Quick Check 1. a. Porm b. Morld Mide Meb 2. String str = ... for (int i = str.length() - 1; str >= 0; str--) { System.out.println(str.charAt(i)); } 3. a. yes b. yes c. yes d. yes e. no, because "language" only has 8 characters, so we can only use charAt between 0 and 7 f. yes 4. equals would say that "Red Sox" is not equal to "red sox", but equalsIgnoreCase would say they are equal