文章目录
- 类加载的过程
- ①加载
- 加载源:
- ②验证
- ③准备
- ④解析
- ⑤初始化
类加载的过程
①加载
加载源:
②验证
主要是语义验证。
主要是执行流:顺序,选择,循环流
③准备
④解析
⑤初始化
public class DeamThread {
static class Hello{
static {
System.out.println(Thread.currentThread().getName() + " init");
}
}
public static void main(String[] args) {
ExecutorService threadPool = Executors.newFixedThreadPool(20);
int i = 0;
while(i++<20){
threadPool.execute(new Runnable() {
@Override
public void run() {
System.out.println(Thread.currentThread().getName() + " start");
Hello h = new Hello();
System.out.println(Thread.currentThread().getName() + " end");
}
});
}
}
}
完