title: Why split() and StringTokenizer() behaving differently
body: <pre><code> public class NewClass
  {
      public static void main(String args[])
       {
          System.out.println("Operation 1");
          StringTokenizer st1 =
              new StringTokenizer("Hello   Geeks How are you", "\\s+");
              while (st1.hasMoreTokens())
              System.out.println(st1.nextToken());
              String s = "Hello   Geeks How are you";
              String s1[]= s.split("\\s+");
              System.out.println("Operation 2");
  
              for( String temp : s1) {
                  System.out.println(temp);
              }
      }
  }
  </code></pre>
  
  <p>Here after executing the code i am getting the output as :-</p>
  
  <pre><code>Operation 1
  Hello   Geek
   How are you
  Operation 2
  Hello
  Geeks
  How
  are
  you
  </code></pre>
  
  <p>I am not getting why split() and StringTokenizer() behaving differently with same parameter.</p>