This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
You should start at the inner-most method call:
When you call indexOf() on a String (in this case, "mail: email@example.com"), 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 "firstname.lastname@example.org". Note that the extra whitespace is preserved at the beginning of the string.