基于LWVCL开发的库

源代码在线查看: uncaughtexception.java

软件大小: 3714 K
上传用户: ywq9089
关键词: LWVCL
下载地址: 免注册下载 普通下载 VIP

相关代码

				/**				 *  This test checks that we indeed invoke the UncaughtException method				 *  for dying threads and that we ignore exceptions in it.				 *				 *  @author Godmar Back 				 */				public class UncaughtException {				    public static void main(String av[]) {					ThreadGroup g = new ThreadGroup("testgroup") {					    int i;					    public void uncaughtException(Thread t, Throwable e) {						synchronized (this) {						    i++;						    if (i == 2) {							((Object)null).hashCode();						    }						    System.out.println("Success " + i + ".");						}					    }					};									for (int i = 0; i < 3; i++) {					    new Thread(g, new Integer(i).toString()) {						public void run() {						    throw new RuntimeException();						}					    }.start();					}				    }				}								/* Expected Output:				Success 1.				Success 3.				*/							

相关资源