Mistake in the question?


Shouldn’t it be address.substring(0,2)?
Indexing starts from 0 right?

I’m not overly familiar with Java but I believe the index of (0, 3) would provide the first 3 characters of that string (like you say, start at 0 but not including character at index 3). So the end point is exclusive of the actual value at index 3 (only values at index 0, 1 & 2).

1 Like

Ah, Okay great, thank you!

1 Like