title: How to take StringTokenizer result to ArrayList in Java?
body: <p>I want to  take <code>StringTokenizer</code> result to <code>ArrayList</code>. I used following code and in 1st print statement, <code>stok.nextToken()</code> print the correct values. But, in second print statement for ArrayList give error as  <code>java.util.NoSuchElementException</code> .
  How I take these results to an ArrayList?</p>
  
  <pre><code> import java.io.BufferedReader;
      import java.io.InputStreamReader;
      import java.util.ArrayList;
      import java.util.StringTokenizer;
  
          public class Test {
          public static void main(String[] args) throws java.io.IOException {
  
              ArrayList&lt;String&gt; myArray = new ArrayList&lt;String&gt;();
              BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
              System.out.print("Enter : ");
              String s = br.readLine();
              StringTokenizer stok = new StringTokenizer(s, "&gt;&lt;");
              while (stok.hasMoreTokens())
                  System.out.println(stok.nextToken()); 
              // -------until now ok
  
              myArray.add(stok.nextToken()); //------------???????????
              System.out.println(myArray);
  
          }
      }
  </code></pre>