class ThreadTest extends Thread {
public void run()
{
System.out.println(this.getName()+"is runing");
}
}
public class Boy {
public static void main(String[] args)
{
final int size = 20;
ThreadTest a[] = new ThreadTest [size] ;
try{
for(int i=0; i< size; i++){
a[i].start();
}
}
catch (Exception e){
e.printStackTrace();
}
System.out.println("mainThread is runing");
}
}
执行之后为嘛只有一句mainThread is runing,而且还报空指针异常 |
|