The JavaDoc for String.substring() states:
[throws] IndexOutOfBoundsException – if beginIndex is negative or larger than the length of this String object.
Since your beginIndex is equal to the length of the string it is a valid value and substring()
returns an empty string.
3
solved What will be the output of String.substring(String.length)?