空指针异常,通常是给不该赋null值的对象赋了null,改如下:
package Thread;
public class PrintStatic implements Runnable
{
  public PrintStatic()
  {
  }
  public static void main(String[] args)
  {
    Thread t1 = new Thread(new PrintStatic(),"t1");
    t1.start();
    Thread t2 = new Thread(new PrintStatic(),"t2");
    t2.start();
    System.out.println("Total Thread Count:"+Thread.activeCount());
    Thread[] threads = new Thread[Thread.activeCount()];
    Thread.enumerate(threads) ;
    for(int i = 0 ; i< threads.length-1 ; i ++)
    {
       System.out.println("Thread Name :"+threads[i].getName());
    }  }
  public void run()
  {
     try
     {
        Thread.sleep(1000);
     }
     catch(Exception e)
     {
        e.printStackTrace();
     }
     aMethod();
  }
  public void aMethod()
  {
     Thread.dumpStack();
  }
}