Tag - thread
J.A.R.V.I.S
Life is not just Live
2019
JAVA线程
基础概念
线程的所有状态:
这些状态都在 Thread
中的State
枚举中定义:
1 | public enum State { |
初始线程
Thread
类Runable
接口Thread
类中调用start()
方法之后会让线程执行run()
方法,而run()
方法中又是对Runable
实例的调用1
2
3
4
5
6
7
8
9/* What will be run. */
private Runnable target;
public void run() {
if (target != null) {
target.run();
}
}
9月 22 · 25 min