Chapter
String Methods
From ComputerScienceOne by Dr Chris Bourke
Concepts
- How do you access individual characters with the String charAt() method?
"Characters in a string are 0-indexed just as with elements in arrays. The charAt() method accesses an individual character by providing an index. String fullName = \"Tom Waits\"; char firstInitial =
- How do you find the length of a string and iterate over its characters?
"When accessing individual characters in a string, it is necessary to know the length of the string so that we do not access invalid characters. The length() method returns an int that represents the
- How does string concatenation work in Java?
"Java has a concatenation operator built into the language. The familiar plus sign, +, can be used to combine one or more strings by appending them to each other. Concatenation results in a new string