Is Java multithreading the easiest way to run multiple methods at once?

I never had to multithreaded, I understand that this is at a basic level. I am wondering what would be the easiest and most effective way to execute three methods at once?

eg

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

Basically, I want to execute 1,2 and 3 at the same time. I am looking for any examples or resources that would be useful for this.

Thank!

+3
source share
1 answer

If your three methods do not share state, you can simply expand the thread for each method.

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

+5
source

Source: https://habr.com/ru/post/1749045/


All Articles