67,513
社区成员
发帖
与我相关
我的任务
分享
package test;
public class ExceptionInThread extends Thread{
Integer id;
ExceptionInThread(Integer id){
this.id = id;
}
/**
* @param args
*/
synchronized void go(){
System.out.println("id is " + id);
throw new java.lang.NullPointerException();
}
public void run(){
// Bean b = new Bean();
// b.go(1);
this.go();
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Thread ct = new ExceptionInThread(1);
Thread ct2 = new ExceptionInThread(2);
ct.start();
ct2.start();
}
}