开发者

Java multithreading easiest way to run multiple methods at once?

I've never had to multithread before, I understand what it is at a basic level. I'm wondering what would be the simplest and most efficent way to execute three methods at once?

e.g

public void test(){
method1();
method2();
method3();
}

Basic开发者_开发技巧ally I want to execute 1,2 and 3 at the same time. I'm looking for any examples or resources which would be useful for doing this.

Thanks!


If your three methods do not share state, you can just spin up a thread for each method.

http://java.sun.com/docs/books/tutorial/essential/concurrency/runthread.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜