title: Java - How split(regex, limit) method actually works?
body: <p>I am trying to understand how the split method works and have a slight confusion about it. In this Example given in the documentation pages of oracle,</p>
  
  <pre><code>String str = "boo:and:foo";
  
  String[] str1 = str.split("o",2);
  
  Output
   b
   o:and:foo
  </code></pre>
  
  <p>This is easy to understand, that the string has been literally divided at the occurence of the first 'o' </p>
  
  <p>but for</p>
  
  <pre><code>String[] str1 = str.split("o",3);
  
  Output:
  b
  
  :and:foo 
  </code></pre>
  
  <p>How is this coming out as such?</p>