You should start at the inner-most method call:
When you call
indexOf() on a
String (in this case, "
mail: [email protected]"), you get the index of the first occurrance of "
mail: " in that string. Since "
mail: " is at the beginning,
indexOf() returns 0.
Then there's the next method call:
As you probably noticed, I replaced the call to
indexOf() with the result to make it easier to read. Calling
substring() on a
String returns a part of that string. Since you're using the
String.substring( int ) version of the method, you get the part of the string starting at index 6 (0+6 = 6). Let's see which part that is:
According to the code block above, substring() should return the string "
[email protected]". Note that the extra whitespace is preserved at the beginning of the string.