You are right: it is divided into each character. However, the split symbol is not returned by this function, so the resulting value is 0.
The important part of javadoc: "So empty lines are not included in the resulting array."
I think you want "Test".split(".", -1).length() , but that will return 5, not 4 (there are 5 'spaces': one to T, one between T and e, others for es, st and last after final t.)
source share