2.15 Strings
Declaring a string
You can declare a string variable just like an int, double, or char. String has a capital "S", however. String wordRelative = " ";
Using a scanner with Strings
wordRelative = scnr.next(); scnr.next(); gets the next input string only up to the next input space, tab, or newline. So typing Betty Sue will only store Betty. Sue will be used for the next input, regardless of what is entered at that point. scnr.nextLine(); reads all user text on the input line up to the newline character resulting from pressing ENTER
String
A sequence of characters. String literal uses double quotes as in "Julia". Various characters may be included: Letters Numbers Spaces Symbols
String Index
Every character in a string has a position number called an index. someString.charAt(0) determines the character at index 0.
String Object
An object consists of internal data items plus operations that can be performed on that data. Two different strings can refer to the same string object.