-
Notifications
You must be signed in to change notification settings - Fork 778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2019-05-30:Java 中使用多线程的方式有哪些? #66
Comments
大概这么4种(如果有其他的方式,麻烦告诉我,奖励你们小花花~): |
感觉回答的不太准确 |
|
常用的方式:
private static final ThreadFactory FACTORY = new ThreadFactory() { 结果 |
常见的 |
Runnable runnable = new Runnable() { @Override
public void run() { System.out.println("Thread with
Runnable started!");
}
};
Thread thread = new Thread(runnable); thread.start();``` |
|
|
1、继承Thread类来实现 2、重写Runnable接口 3、重写Callable接口 4、通过线程池启动 |
No description provided.
The text was updated successfully, but these errors were encountered: