Java,NullpointerException
<pre><code>import java.io.*;
public class listjava
{
   public static void main(String args[]){
       Console c = System.console();
       char[] pw;
       pw = c.readPassword("%s","pw: ");
       for (char ch: pw)
           c.format("%c ",ch);
       c.format("\n");

       MyUtility mu = new MyUtility();
       while(true)
       {
           String name = c.readLine("%s","input?: ");
           c.format("output : %s \n",mu.doStuff(name));
       }
    }
}

class MyUtility{
    String doStuff (String arg1){
        return " result is " + arg1;
    }
}
</code></pre>

<p>I got error like this:</p>

<pre><code>Exception in thread "main" java.lang.NullPointerException
   at listjava.main(listjava.java:7)
</code></pre>

<p>Could anyone tell me why my program is wrong?   Thanks.</p>
