tokenizer and "Exception in thread "main" java.lang.NullPointerException" runtime error
<p>I'm trying to tokenize a string and assign each token to a cell of array in java. this is my code to tokenize but I got following run-time error:</p>

<pre><code>Exception in thread "main" java.lang.NullPointerException
</code></pre>

<p>this error is appeared at line 10.</p>

<p>can anybody help me to solve this error bye an example????? </p>

<pre><code>#1              Scanner in = new Scanner(System.in);
#2              System.out.print("Enter your name: ");
#3              String name = in.nextLine();
#4              String a[]=null;
#5              int i=0;
#6              StringTokenizer tokenizer=new StringTokenizer(name," ");
#7              while (tokenizer.hasMoreTokens())
#8              {
#9                       String token = tokenizer.nextToken();
#10                      a[i]= token;
#11                       i++;
#12             }
</code></pre>
