Rob has hinted how Strings are implemented in Java. There are three well-known ways to implement Strings:
1. as in Pascal, starting with a count byte, which is sometimes called a "Pascal String."2. as in C, the null-terminated String3. as in Java.Java maintains an array of
chars, each representing a character, and the array has a
length field, which tells the string class how many letters/characters there are.
You will find a bit more in
this Joel Spolsky article.
[There are some characters which are represented by two
chars in Java, but let's forget about them for now.]