The output from the following code is 123 because substring takes from beginIndex to EndIndex - 1. However, I am surprised how char
123
substring
char
Take a look at section 5.1.2, where it discusses widening conversions.