一.Thread API: setDefaultUncaughtExceptionHandler(Thread.UncaughtExceptionHandler eh) 首先要了解什么是Thread.UncaughtExceptionHandler,默认来说当线程出现未捕获的异常时,会中断并抛出异常,抛出后的动作只有简单的堆栈输出.如: public class ThreadTest{ public static void main(String[] args) throws Exception…
一.Thread的使用 (1)sleep:进程等一会 (2)join:让并发处理变成串行 (3)start:启动线程的唯一方法,start()首先为线程分配必须的系统资源,调度线程运行并执行线程的run()方法 (4)run:放入的是线程的工作 public class HelloWord { public static void main(String[] args) { Thread t = new Thread(new Runnable() { @Override public void…