LECTURE OCTOBER 25 2004 ASSIGNMENTS Wed 10/27 Assignment 3 Design Fri 10/29 CodeLab #8 QUESTIONS Why caps before lower case in ASCII? - String manipulation is easier - that's also the way things are in the dictionary What happens if we print the delete character? - on my home computer, I get a lowercase delta symbol - I tried a couple of other characters (0, 1) and got nothing and a smiley face STRINGS AND SOME OF THEIR METHODS What? - *string* How? - In Java, String class What? - indexing: numbering the characters in a string How? - zero-based What? - String instance method - length method - returns the number of characters in a string What? - relationship between the number of characters in a string and their indexing - last character has the index (length - 1) What? - charAt method How? - String instance method - first argument: int - returns the character at that position in the string What? - *out-of-bound exception* How? - avoid using short-circuit evaluation - example: finding the index of the first instance of a character What? - substring method How? - String instance method - first argument: int beginning index - second argument: int end index - returns the String from the beginning index, inclusive, up to the end index, exclusive What? - toUpperCase method How? - String instance method - returns a new String which is the original String in all uppercase - does not alter the original String COMPARING STRINGS What? - primitives or references How? - references if created using new - primitives if created with a literal What? - compare using the == How? - true if the variables point to the same object What? - *equivalence test* - equals method How? - String instance method - returns true if the characters at each position match What? - == versus the equals method - equals method will always return true if == returns true - not necessarily vice-versa What? - equalsIgnoreCase method How? - String instance method - returns true if the characters at each position are the same, ignoring case