Programmer Question
Suppose you have this expression in Java:
"adam".split("")
This is telling Java to split "adam"
using the empty string (""
) as the delimiter. This yields:
["", "a", "d", "a", "m"]
Why does Java include an empty string at the start, but not at the end? Using this logic, shouldn't the result have been:
["", "a", "d", "a", "m", ""]
Find the answer here
No comments:
Post a Comment