A bit more explanation is called for. If you go through the Java™ Tutorials section, you find that | is a "meta-character" for "OR" which means you are splitting on what is before the | or what is after the |. So in this instance you are splitting on "nothing" or "nothing". After each letter the application finds"nothing" so it splits there.
Don't know if i'm thinking correct but shouldn't splitting on 'nothing' mean the entire string becomes one token. Wouldnt this always be false (where NOTHING is empty string)?
Nev Mehta wrote:Don't know if i'm thinking correct but shouldn't splitting on 'nothing' mean the entire string becomes one token. Wouldnt this always be false (where NOTHING is empty string)?
No, it means "if you find nothing after this character and before the next." And there is always "nothing" between character 1 and character 2!